use calloc and by that way avoid NULL de-ref, cid#31

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24133 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-12-11 05:05:21 +00:00
parent 1f82ad5700
commit dfa2b7030c

View File

@@ -500,10 +500,9 @@ kcm_ccache_store_cred_internal(krb5_context context,
for (c = &ccache->creds; *c != NULL; c = &(*c)->next)
;
*c = (struct kcm_creds *)malloc(sizeof(struct kcm_creds));
if (*c == NULL) {
*c = (struct kcm_creds *)calloc(1, sizeof(**c));
if (*c == NULL)
return KRB5_CC_NOMEM;
}
RAND_bytes((*c)->uuid, sizeof((*c)->uuid));
@@ -520,8 +519,6 @@ kcm_ccache_store_cred_internal(krb5_context context,
ret = 0;
}
(*c)->next = NULL;
return ret;
}