]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix unlikely memory leak in KCM client
authorGreg Hudson <ghudson@mit.edu>
Tue, 2 Sep 2014 18:02:26 +0000 (14:02 -0400)
committerGreg Hudson <ghudson@mit.edu>
Tue, 2 Sep 2014 20:10:13 +0000 (16:10 -0400)
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

index 926a99c5999caaa71ea2ad5f0b4c42e5ba2a2bfb..1e404ee279d3ea37639b7c193bca3d375acbacec 100644 (file)
@@ -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;