(krb5_derive_key): Free more of the allocated memory, this function is

only used by the test program.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16343 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-12-02 14:47:44 +00:00
parent e4794726e4
commit eb0369c938

View File

@@ -3942,6 +3942,8 @@ krb5_derive_key(krb5_context context,
struct encryption_type *et; struct encryption_type *et;
struct key_data d; struct key_data d;
*derived_key = NULL;
et = _find_enctype (etype); et = _find_enctype (etype);
if (et == NULL) { if (et == NULL) {
krb5_set_error_string(context, "encryption type %d not supported", krb5_set_error_string(context, "encryption type %d not supported",
@@ -3949,16 +3951,15 @@ krb5_derive_key(krb5_context context,
return KRB5_PROG_ETYPE_NOSUPP; return KRB5_PROG_ETYPE_NOSUPP;
} }
ret = krb5_copy_keyblock(context, key, derived_key); ret = krb5_copy_keyblock(context, key, &d.key);
if (ret) if (ret)
return ret; return ret;
d.key = *derived_key;
d.schedule = NULL; d.schedule = NULL;
ret = derive_key(context, et, &d, constant, constant_len); ret = derive_key(context, et, &d, constant, constant_len);
if (ret) if (ret == 0)
return ret; ret = krb5_copy_keyblock(context, d.key, derived_key);
ret = krb5_copy_keyblock(context, d.key, derived_key); free_key_data(context, &d);
return ret; return ret;
} }