pull up r22718 from trunk
authorTom Yu <tlyu@mit.edu>
Tue, 12 Jan 2010 02:50:09 +0000 (02:50 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 12 Jan 2010 02:50:09 +0000 (02:50 +0000)
 ------------------------------------------------------------------------
 r22718 | ghudson | 2009-09-09 11:17:09 -0400 (Wed, 09 Sep 2009) | 8 lines

 ticket: 6558
 subject: Fix memory leak in gss_krb5int_copy_ccache
 tags: pullup
 target_version: 1.7.1

 gss_krb5int_copy_ccache was iterating over credentials in a ccache
 without freeing them.

ticket: 6558
version_fixed: 1.7.1
status: resolved

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-7@23635 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/copy_ccache.c

index e7b48e04f11a5e86fbccc3957ce25edfca554f69..19fe1d788a3b0819b58c9eff6604161d55fc8b5f 100644 (file)
@@ -50,8 +50,11 @@ gss_krb5int_copy_ccache(OM_uint32 *minor_status,
         krb5_free_context(context);
         return(GSS_S_FAILURE);
     }
-    while (!code && !krb5_cc_next_cred(context, k5creds->ccache, &cursor, &creds))
+    while (!code && !krb5_cc_next_cred(context, k5creds->ccache, &cursor,
+                                       &creds)) {
         code = krb5_cc_store_cred(context, out_ccache, &creds);
+        krb5_free_cred_contents(context, &creds);
+    }
     krb5_cc_end_seq_get(context, k5creds->ccache, &cursor);
     k5_mutex_unlock(&k5creds->lock);
     *minor_status = code;