mit-kdb: Use calloc() to allocate memory
authorAndreas Schneider <asn@samba.org>
Thu, 15 Dec 2016 16:50:53 +0000 (17:50 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 12 Jan 2017 14:35:12 +0000 (15:35 +0100)
This avoids a memset().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/kdc/mit-kdb/kdb_samba_principals.c

index dc24e7e3cbe8d2474e32c130d6c8a140cadeb918..a777df840a2df28fb08f25ef84902d84a6611cf3 100644 (file)
@@ -78,13 +78,11 @@ static krb5_error_code ks_get_master_key_principal(krb5_context context,
 
        *kentry_ptr = NULL;
 
-       kentry = malloc(sizeof(krb5_db_entry));
+       kentry = calloc(1, sizeof(krb5_db_entry));
        if (kentry == NULL) {
                return ENOMEM;
        }
 
-       ZERO_STRUCTP(kentry);
-
        kentry->magic = KRB5_KDB_MAGIC_NUMBER;
        kentry->len = KRB5_KDB_V1_BASE_LENGTH;
        kentry->attributes = KRB5_KDB_DISALLOW_ALL_TIX;