]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix minor memory leak in klist (again) 197/head
authorGreg Hudson <ghudson@mit.edu>
Wed, 27 Aug 2014 20:15:46 +0000 (16:15 -0400)
committerGreg Hudson <ghudson@mit.edu>
Sat, 4 Oct 2014 23:49:48 +0000 (19:49 -0400)
Commit 6e51f9cc3152c8e419fe7f459bcf521d60358434 attempted to fix two
minor memory leaks in klist, but one of the fixes was dead code.  In
do_ccache, free princ before we look at the code which terminated the
loop, not after we have returned on either branch.

src/clients/klist/klist.c

index 51eaa07930c6489cf5a1bfb64452bc972fbdc6d1..9058e8f1733c72bd5bde0032e70737413568c26c 100644 (file)
@@ -533,6 +533,7 @@ do_ccache(krb5_ccache cache)
         }
         krb5_free_cred_contents(kcontext, &creds);
     }
+    krb5_free_principal(kcontext, princ);
     if (code == KRB5_CC_END) {
         if ((code = krb5_cc_end_seq_get(kcontext, cache, &cur))) {
             if (!status_only)
@@ -555,7 +556,6 @@ do_ccache(krb5_ccache cache)
             com_err(progname, code, _("while retrieving a ticket"));
         return 1;
     }
-    krb5_free_principal(kcontext, princ);
 }
 
 char *