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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user