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

Tom Yu tlyu at mit.edu
Tue Apr 5 23:02:54 EDT 2016


https://github.com/krb5/krb5/commit/ccb1b1ade68c22bb263a42349424bdf0506ac533
commit ccb1b1ade68c22bb263a42349424bdf0506ac533
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.14.2

 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 cb2cf35..a52c960 100644
--- a/src/kdc/do_tgs_req.c
+++ b/src/kdc/do_tgs_req.c
@@ -975,7 +975,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;
@@ -1002,7 +1002,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