krb5 commit [krb5-1.13]: Fix memory leak on error in KDC decrypt_2ndtkt()

Tom Yu tlyu at mit.edu
Wed Apr 6 14:07:09 EDT 2016


https://github.com/krb5/krb5/commit/94ea7ae4039c553b3d7df5da384240d612782ba1
commit 94ea7ae4039c553b3d7df5da384240d612782ba1
Author: Greg Hudson <ghudson at mit.edu>
Date:   Thu Feb 25 11:19:17 2016 -0500

    Fix memory leak on error in KDC decrypt_2ndtkt()
    
    Make sure to release the server principal entry in the cleanup handler
    if it is not assigned to the output parameter.  Reported by Will
    Fiveash.
    
    (cherry picked from commit a1faaa4d6a404e3103f45e639b8890c3b141dfe1)
    
    ticket: 8362
    version_fixed: 1.13.5
    status: resolved
    tags: -pullup

 src/kdc/do_tgs_req.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/kdc/do_tgs_req.c b/src/kdc/do_tgs_req.c
index fce478e..48e822b 100644
--- a/src/kdc/do_tgs_req.c
+++ b/src/kdc/do_tgs_req.c
@@ -952,7 +952,7 @@ decrypt_2ndtkt(kdc_realm_t *kdc_active_realm, krb5_kdc_req *req,
                const char **status)
 {
     krb5_error_code retval;
-    krb5_db_entry *server;
+    krb5_db_entry *server = NULL;
     krb5_keyblock *key;
     krb5_kvno kvno;
     krb5_ticket *stkt;
@@ -979,7 +979,9 @@ decrypt_2ndtkt(kdc_realm_t *kdc_active_realm, krb5_kdc_req *req,
         goto cleanup;
     }
     *server_out = server;
+    server = NULL;
 cleanup:
+    krb5_db_free_principal(kdc_context, server);
     return retval;
 }
 


More information about the cvs-krb5 mailing list