ciphertext if there is an error; this prevents stuff farther up
from freeing freed memory.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11531
dc483132-0cff-0310-8789-
dd5450dbe970
+1999-06-28 Tom Yu <tlyu@mit.edu>
+
+ * enc_helper.c (krb5_encrypt_helper): NULL out the pointer to the
+ ciphertext if there is an error; this prevents stuff farther up
+ from freeing freed memory.
+
1999-06-18 Ken Raeburn <raeburn@mit.edu>
* init_ctx.c (krb5_free_context): Set field pointers to NULL after
cipher->ciphertext.length = enclen;
if ((cipher->ciphertext.data = (char *) malloc(enclen)) == NULL)
return(ret);
-
- if (ret = krb5_c_encrypt(context, key, usage, 0, plain, cipher))
+ ret = krb5_c_encrypt(context, key, usage, 0, plain, cipher);
+ if (ret) {
free(cipher->ciphertext.data);
+ cipher->ciphertext.data = NULL;
+ }
return(ret);
}