krb5 commit: Fix minor memory leaks in acquire_cred.c

Greg Hudson ghudson at MIT.EDU
Mon Jul 2 14:13:47 EDT 2012


https://github.com/krb5/krb5/commit/76e5a44413c6bdb061263ed7d33ff7b494fa485a
commit 76e5a44413c6bdb061263ed7d33ff7b494fa485a
Author: Greg Hudson <ghudson at mit.edu>
Date:   Mon Jul 2 13:21:04 2012 -0400

    Fix minor memory leaks in acquire_cred.c

 src/lib/gssapi/krb5/acquire_cred.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lib/gssapi/krb5/acquire_cred.c b/src/lib/gssapi/krb5/acquire_cred.c
index 1972b1e..0527d13 100644
--- a/src/lib/gssapi/krb5/acquire_cred.c
+++ b/src/lib/gssapi/krb5/acquire_cred.c
@@ -774,10 +774,8 @@ acquire_cred(OM_uint32 *minor_status, gss_name_t desired_name,
 
     if (name != NULL) {
         code = kg_duplicate_name(context, name, &cred->name);
-        if (code) {
-            *minor_status = code;
-            return GSS_S_FAILURE;
-        }
+        if (code)
+            goto krb_error_out;
     }
 
 #ifndef LEAN_CLIENT
@@ -834,6 +832,8 @@ error_out:
     if (cred != NULL) {
         if (cred->ccache)
             krb5_cc_close(context, cred->ccache);
+        if (cred->client_keytab)
+            krb5_kt_close(context, cred->client_keytab);
 #ifndef LEAN_CLIENT
         if (cred->keytab)
             krb5_kt_close(context, cred->keytab);


More information about the cvs-krb5 mailing list