krb5_copy_keyblock: on malloc error, free keyblock
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24102 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -77,15 +77,24 @@ krb5_copy_keyblock (krb5_context context,
|
|||||||
const krb5_keyblock *inblock,
|
const krb5_keyblock *inblock,
|
||||||
krb5_keyblock **to)
|
krb5_keyblock **to)
|
||||||
{
|
{
|
||||||
|
krb5_error_code ret;
|
||||||
krb5_keyblock *k;
|
krb5_keyblock *k;
|
||||||
|
|
||||||
|
*to = NULL;
|
||||||
|
|
||||||
k = malloc (sizeof(*k));
|
k = calloc (1, sizeof(*k));
|
||||||
if (k == NULL) {
|
if (k == NULL) {
|
||||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = krb5_copy_keyblock_contents (context, inblock, k);
|
||||||
|
if (ret) {
|
||||||
|
free(k);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
*to = k;
|
*to = k;
|
||||||
return krb5_copy_keyblock_contents (context, inblock, k);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
krb5_enctype
|
krb5_enctype
|
||||||
|
Reference in New Issue
Block a user