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:
Love Hörnquist Åstrand
2008-12-11 04:59:58 +00:00
parent a3107b9af4
commit f97807582c

View File

@@ -77,15 +77,24 @@ krb5_copy_keyblock (krb5_context context,
const krb5_keyblock *inblock,
krb5_keyblock **to)
{
krb5_error_code ret;
krb5_keyblock *k;
*to = NULL;
k = malloc (sizeof(*k));
k = calloc (1, sizeof(*k));
if (k == NULL) {
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
return ENOMEM;
}
ret = krb5_copy_keyblock_contents (context, inblock, k);
if (ret) {
free(k);
return ret;
}
*to = k;
return krb5_copy_keyblock_contents (context, inblock, k);
return 0;
}
krb5_enctype