Skip to content

Commit

Permalink
Fix memory leak in krb5_verify_init_creds
Browse files Browse the repository at this point in the history
When copying most of the credentials from one cache to another in
copy_creds_except (called from get_vfy_cred, from
krb5_verify_init_creds), we need to free all of the credentials that
we read, not just the ones we copied.

[ghudson@mit.edu: edited commit message]

(cherry picked from commit 27b136d)

ticket: 8089 (new)
version_fixed: 1.11.6
status: resolved
  • Loading branch information
nalind authored and tlyu committed Feb 6, 2015
1 parent 2faf2b4 commit 33df3ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/krb5/krb/vfy_increds.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ copy_creds_except(krb5_context context, krb5_ccache incc,

while (!(ret = krb5_cc_next_cred(context, incc, &cur, &creds))) {
if (krb5_principal_compare(context, princ, creds.server))
continue;

ret = krb5_cc_store_cred(context, outcc, &creds);
ret = 0;
else
ret = krb5_cc_store_cred(context, outcc, &creds);
krb5_free_cred_contents(context, &creds);
if (ret)
goto cleanup;
Expand Down

0 comments on commit 33df3ae

Please sign in to comment.