aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2014-10-20 13:19:26 -0400
committerTom Yu <tlyu@mit.edu>2015-02-14 16:01:40 -0500
commita5d9bdf921e0bc855e4f0b21403e543e18e2b1cf (patch)
tree40fb918e996aed851a2c2a8b9cbc6848d4d48d0a
parent2cc99002e81bdb1ce0d26f27c165d2d945057a41 (diff)
downloadkrb5-a5d9bdf921e0bc855e4f0b21403e543e18e2b1cf.zip
krb5-a5d9bdf921e0bc855e4f0b21403e543e18e2b1cf.tar.gz
krb5-a5d9bdf921e0bc855e4f0b21403e543e18e2b1cf.tar.bz2
Fix cursor leak in krb5_verify_init_creds
In copy_creds_except, call krb5_cc_end_seq_get so we don't leak the ccache cursor. (cherry picked from commit 62894f854daa8251554376b6b6810fd0e9fecb7f) ticket: 8144 (new) version_fixed: 1.11.6 status: resolved
-rw-r--r--src/lib/krb5/krb/vfy_increds.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/krb5/krb/vfy_increds.c b/src/lib/krb5/krb/vfy_increds.c
index 4833992..8ceab7d 100644
--- a/src/lib/krb5/krb/vfy_increds.c
+++ b/src/lib/krb5/krb/vfy_increds.c
@@ -56,7 +56,7 @@ copy_creds_except(krb5_context context, krb5_ccache incc,
krb5_ccache outcc, krb5_principal princ)
{
krb5_error_code ret, ret2;
- krb5_cc_cursor cur;
+ krb5_cc_cursor cur = NULL;
krb5_creds creds;
/* Turn off TC_OPENCLOSE on input ccache. */
@@ -79,9 +79,13 @@ copy_creds_except(krb5_context context, krb5_ccache incc,
if (ret != KRB5_CC_END)
goto cleanup;
- ret = 0;
+
+ ret = krb5_cc_end_seq_get(context, incc, &cur);
+ cur = NULL;
cleanup:
+ if (cur != NULL)
+ (void)krb5_cc_end_seq_get(context, incc, &cur);
ret2 = krb5_cc_set_flags(context, incc, KRB5_TC_OPENCLOSE);
return (ret == 0) ? ret2 : ret;
}