summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@dahyabhai.net>2014-02-17 17:14:20 -0500
committerGreg Hudson <ghudson@mit.edu>2014-03-13 11:39:44 -0400
commit27b136d2e3181e787b2d4a03ee712d5d5137f5cd (patch)
treed0c6f71ad9fae039f315d5d27f250f8195f58acf /src/lib/krb5
parent1ed3f68c2394fbb48731bba4e4e9a60c8b925ca5 (diff)
downloadkrb5-27b136d2e3181e787b2d4a03ee712d5d5137f5cd.tar.gz
krb5-27b136d2e3181e787b2d4a03ee712d5d5137f5cd.tar.xz
krb5-27b136d2e3181e787b2d4a03ee712d5d5137f5cd.zip
Fix memory leak in krb5_verify_init_creds
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] ticket: 7875 (new) target_version: 1.12.2 tags: pullup
Diffstat (limited to 'src/lib/krb5')
-rw-r--r--src/lib/krb5/krb/vfy_increds.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/krb5/krb/vfy_increds.c b/src/lib/krb5/krb/vfy_increds.c
index e88a37f80..483399235 100644
--- a/src/lib/krb5/krb/vfy_increds.c
+++ b/src/lib/krb5/krb/vfy_increds.c
@@ -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;