Skip to content

Commit

Permalink
Fix cursor leak in krb5_verify_init_creds
Browse files Browse the repository at this point in the history
In copy_creds_except, call krb5_cc_end_seq_get so we don't leak the
ccache cursor.

(cherry picked from commit 62894f8)

ticket: 8133 (new)
version_fixed: 1.12.3
status: resolved
  • Loading branch information
greghudson authored and tlyu committed Feb 10, 2015
1 parent 6bb20d1 commit 7cd2e47
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/krb5/krb/vfy_increds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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;
}
Expand Down

0 comments on commit 7cd2e47

Please sign in to comment.