When returning an error, don't also pass back an invalid pointer
authorKen Raeburn <raeburn@mit.edu>
Fri, 27 Jun 2008 03:20:48 +0000 (03:20 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 27 Jun 2008 03:20:48 +0000 (03:20 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20484 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/old_api_glue.c

index fda16909a3a7ebc90c299280b0881f4533288640..4db0c3359477ec61d84ed0e58f382e7ebb7cd6d1 100644 (file)
@@ -147,8 +147,10 @@ krb5_random_key(krb5_context context, const krb5_encrypt_block *eblock,
     if ((key = (krb5_keyblock *) malloc(sizeof(krb5_keyblock))) == NULL)
        return(ENOMEM);
 
-    if ((ret = krb5_c_make_random_key(context, eblock->crypto_entry, key)))
+    if ((ret = krb5_c_make_random_key(context, eblock->crypto_entry, key))) {
        free(key);
+       key = NULL;
+    }
 
     *keyblock = key;