[28614] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix minor memory leak in klist (again)

daemon@ATHENA.MIT.EDU (Greg Hudson)
Sat Oct 4 19:59:56 2014

Date: Sat, 4 Oct 2014 19:59:50 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201410042359.s94NxoD0005482@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/319d98bf13e8486f9f378ee47147c9c4bdb15c37
commit 319d98bf13e8486f9f378ee47147c9c4bdb15c37
Author: Greg Hudson <ghudson@mit.edu>
Date:   Wed Aug 27 16:15:46 2014 -0400

    Fix minor memory leak in klist (again)
    
    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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c
index 51eaa07..9058e8f 100644
--- a/src/clients/klist/klist.c
+++ b/src/clients/klist/klist.c
@@ -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 *
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post