diff --git a/lib/hdb/hdb-ldap.c b/lib/hdb/hdb-ldap.c index aa0cad000..60504e21a 100644 --- a/lib/hdb/hdb-ldap.c +++ b/lib/hdb/hdb-ldap.c @@ -1701,14 +1701,14 @@ hdb_ldap_common(krb5_context context, } memset(*db, 0, sizeof(**db)); - h = malloc(sizeof(*h)); + h = calloc(1, sizeof(*h)); if (h == NULL) { krb5_set_error_string(context, "malloc: out of memory"); free(*db); *db = NULL; return ENOMEM; } - memset(h, 0, sizeof(*h)); + (*db)->hdb_db = h; /* XXX */ if (asprintf(&(*db)->hdb_name, "ldap:%s", search_base) == -1) {