(krb5_build_authenticator): use calloc. removed check that was never
really used. Coverity NetBSD CID#2370 git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17033 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -116,13 +116,12 @@ krb5_build_authenticator (krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_crypto crypto;
|
krb5_crypto crypto;
|
||||||
|
|
||||||
auth = malloc(sizeof(*auth));
|
auth = calloc(1, sizeof(*auth));
|
||||||
if (auth == NULL) {
|
if (auth == NULL) {
|
||||||
krb5_set_error_string(context, "malloc: out of memory");
|
krb5_set_error_string(context, "malloc: out of memory");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (auth, 0, sizeof(*auth));
|
|
||||||
auth->authenticator_vno = 5;
|
auth->authenticator_vno = 5;
|
||||||
copy_Realm(&cred->client->realm, &auth->crealm);
|
copy_Realm(&cred->client->realm, &auth->crealm);
|
||||||
copy_PrincipalName(&cred->client->name, &auth->cname);
|
copy_PrincipalName(&cred->client->name, &auth->cname);
|
||||||
@@ -161,10 +160,8 @@ krb5_build_authenticator (krb5_context context,
|
|||||||
|
|
||||||
/* XXX - Copy more to auth_context? */
|
/* XXX - Copy more to auth_context? */
|
||||||
|
|
||||||
if (auth_context) {
|
auth_context->authenticator->ctime = auth->ctime;
|
||||||
auth_context->authenticator->ctime = auth->ctime;
|
auth_context->authenticator->cusec = auth->cusec;
|
||||||
auth_context->authenticator->cusec = auth->cusec;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASN1_MALLOC_ENCODE(Authenticator, buf, buf_size, auth, &len, ret);
|
ASN1_MALLOC_ENCODE(Authenticator, buf, buf_size, auth, &len, ret);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
Reference in New Issue
Block a user