krb5 commit: Fix unlikely memory leak in KCM client

Greg Hudson ghudson at mit.edu
Tue Sep 2 17:48:59 EDT 2014


https://github.com/krb5/krb5/commit/935de68b110ca0369e4cf16bbdc7da74b5799e69
commit 935de68b110ca0369e4cf16bbdc7da74b5799e69
Author: Greg Hudson <ghudson at mit.edu>
Date:   Tue Sep 2 14:02:26 2014 -0400

    Fix unlikely memory leak in KCM client
    
    Commit 956cbd24e645609c94fbc836840ce0f87ba3ce79 created a memory leak
    if the KCM_OP_GET_DEFAULT_CACHE call fails inside kcm_ptcursor_new
    after the KCM_OP_GET_CACHE_UUID_LIST call succeeds.  Fix it.
    
    ticket: 8002

 src/lib/krb5/ccache/cc_kcm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/lib/krb5/ccache/cc_kcm.c b/src/lib/krb5/ccache/cc_kcm.c
index 926a99c..1e404ee 100644
--- a/src/lib/krb5/ccache/cc_kcm.c
+++ b/src/lib/krb5/ccache/cc_kcm.c
@@ -869,7 +869,7 @@ kcm_ptcursor_new(krb5_context context, krb5_cc_ptcursor *cursor_out)
     krb5_error_code ret;
     struct kcmreq req = EMPTY_KCMREQ;
     struct kcmio *io = NULL;
-    struct uuid_list *uuids;
+    struct uuid_list *uuids = NULL;
     const char *defname, *primary;
 
     *cursor_out = NULL;
@@ -911,9 +911,11 @@ kcm_ptcursor_new(krb5_context context, krb5_cc_ptcursor *cursor_out)
         goto cleanup;
 
     ret = make_ptcursor(primary, uuids, io, cursor_out);
+    uuids = NULL;
     io = NULL;
 
 cleanup:
+    free_uuid_list(uuids);
     kcmio_close(io);
     kcmreq_free(&req);
     return ret;


More information about the cvs-krb5 mailing list