From: Paul Park Date: Tue, 8 Aug 1995 22:01:34 +0000 (+0000) Subject: Don't deallocate key/salt tuples if supplied by caller to string_to_key X-Git-Tag: krb5-1.0-beta6~1362 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=92b1fae527c4a04fdbb094497cea26937715e786;p=krb5.git Don't deallocate key/salt tuples if supplied by caller to string_to_key git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6464 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/v5server/srv_key.c b/src/kadmin/v5server/srv_key.c index 37cdbf573..c09a19090 100644 --- a/src/kadmin/v5server/srv_key.c +++ b/src/kadmin/v5server/srv_key.c @@ -766,6 +766,7 @@ key_string_to_keys(kcontext, dbentp, string, nksalt, ksaltp, nkeysp, keysp) krb5_int32 nkeysalts; krb5_key_data *keys; struct keysalt_iterate_args ksargs; + krb5_boolean did_alloc; DPRINT(DEBUG_CALLS, key_debug_level, ("* key_string_to_keys()\n")); @@ -775,8 +776,11 @@ key_string_to_keys(kcontext, dbentp, string, nksalt, ksaltp, nkeysp, keysp) */ keysalts = ksaltp; nkeysalts = nksalt; - if (!keysalts || !nkeysalts) + did_alloc = 0; + if (!keysalts || !nkeysalts) { kret = key_dbent_to_keysalts(dbentp, &nkeysalts, &keysalts); + did_alloc = 1; + } if (keysalts && nkeysalts) { if (keys = (krb5_key_data *) malloc((size_t) (nkeysalts * sizeof(krb5_key_data)))) { @@ -794,7 +798,8 @@ key_string_to_keys(kcontext, dbentp, string, nksalt, ksaltp, nkeysp, keysp) } else kret = ENOMEM; - krb5_xfree(keysalts); + if (did_alloc) + krb5_xfree(keysalts); } done: if (!kret) {