Skip to content

Commit

Permalink
Fix rare leak in krb5_cccol_have_content()
Browse files Browse the repository at this point in the history
If krb5_cc_start_seq_get() fails inside the loop, close the current
credential cache before continuing to the next one.  Reported by Todd
Lipcon.

(cherry picked from commit 1735f2e)

ticket: 8509
version_fixed: 1.15
  • Loading branch information
greghudson authored and tlyu committed Oct 24, 2016
1 parent f94a9e9 commit 3bb6e66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/krb5/ccache/cccursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,10 @@ krb5_cccol_have_content(krb5_context context)

ret = krb5_cc_start_seq_get(context, cache, &cache_cursor);
save_first_error(context, ret, &errsave);
if (ret)
if (ret) {
krb5_cc_close(context, cache);
continue;
}
while (!found) {
ret = krb5_cc_next_cred(context, cache, &cache_cursor, &creds);
save_first_error(context, ret, &errsave);
Expand Down

0 comments on commit 3bb6e66

Please sign in to comment.