summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/crypto/old_api_glue.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/crypto/old_api_glue.c b/src/lib/crypto/old_api_glue.c
index fda16909a..4db0c3359 100644
--- a/src/lib/crypto/old_api_glue.c
+++ b/src/lib/crypto/old_api_glue.c
@@ -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;