summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeng Xue <xnsuda@yahoo.com>2014-05-07 14:11:14 -0700
committerGreg Hudson <ghudson@mit.edu>2014-05-08 11:08:54 -0400
commit60234f7b4cef58b66e0b2776988dfcf79c0d8bbb (patch)
tree5f2eacb7168965300acd0cb79649e1279dc088d2
parent0477f69ba67e7071cb3671f94c466ba99f15285e (diff)
downloadkrb5-60234f7b4cef58b66e0b2776988dfcf79c0d8bbb.tar.gz
krb5-60234f7b4cef58b66e0b2776988dfcf79c0d8bbb.tar.xz
krb5-60234f7b4cef58b66e0b2776988dfcf79c0d8bbb.zip
Fix unlikely memory error in krb5_rd_cred
If an error occurs in the for loop in krb5_rd_cred_basic (which should only happen on an ENOMEM), do not leave the caller with a dangling reference to the freed credential array. ticket: 7908 (new) target_version: 1.12.2
-rw-r--r--src/lib/krb5/krb/rd_cred.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/krb5/krb/rd_cred.c b/src/lib/krb5/krb/rd_cred.c
index 8be7f81d6..acc05c99b 100644
--- a/src/lib/krb5/krb/rd_cred.c
+++ b/src/lib/krb5/krb/rd_cred.c
@@ -170,8 +170,10 @@ krb5_rd_cred_basic(krb5_context context, krb5_data *pcreddata,
(*pppcreds)[i] = NULL;
cleanup:
- if (retval)
+ if (retval) {
krb5_free_tgt_creds(context, *pppcreds);
+ *pppcreds = NULL;
+ }
cleanup_cred:
krb5_free_cred(context, pcred);