[1246] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

krb5b4pl3: lib/krb5/krb/gen_subkey.c: doesn't need to allocate space for key

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Tue Mar 21 20:16:46 1995

From: "Jonathan I. Kamens" <jik@cam.ov.com>
Date: Tue, 21 Mar 1995 20:19:47 -0500
To: krb5-bugs@MIT.EDU

krb5_generate_subkey() doesn't need to allocate space for the subkey
it's returning, because the etype-specific function that actually
creates the random key does the memory allocation.
C.f. lib/crypto/des/random_key.c.

Here's a patch:

--- gen_subkey.c	1995/03/22 01:18:43	1.1
+++ gen_subkey.c	1995/03/22 01:18:48
@@ -44,11 +44,6 @@
 
     if (retval = krb5_init_random_key(&eblock, key, &random_state))
 	return(retval);
-    *subkey = (krb5_keyblock *)malloc(sizeof(**subkey));
-    if (!*subkey) {
-	(void) krb5_finish_random_key(&eblock, &random_state);
-	return ENOMEM;
-    }
 	
     if (retval = krb5_random_key(&eblock, random_state, subkey)) {
 	(void) krb5_finish_random_key(&eblock, &random_state);

home help back first fref pref prev next nref lref last post