From 0792c15b716d87c557ada36f57691f8a284ea54f Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Thu, 22 Sep 2005 17:29:08 +0000 Subject: [PATCH] pullup r17387 from trunk ticket: 3185 version_fixed: 1.4.3 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17393 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/ChangeLog | 6 ++++++ src/lib/krb5/krb/mk_req_ext.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index e14a1bf7c..d96aa445a 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,9 @@ +2005-09-22 Tom Yu + + * mk_req_ext.c (krb5int_generate_and_save_subkey): Check for and + free pre-existing subkeys before clobbering the pointers. This + fixes some memory leaks. + 2005-08-15 Tom Yu * get_in_tkt.c (krb5_get_init_creds): Free tempstr on non-error diff --git a/src/lib/krb5/krb/mk_req_ext.c b/src/lib/krb5/krb/mk_req_ext.c index deeb12387..9066567ba 100644 --- a/src/lib/krb5/krb/mk_req_ext.c +++ b/src/lib/krb5/krb/mk_req_ext.c @@ -90,8 +90,13 @@ krb5int_generate_and_save_subkey (krb5_context context, d.data = (char *) &rnd_data; (void) krb5_c_random_add_entropy (context, KRB5_C_RANDSOURCE_TIMING, &d); + if (auth_context->send_subkey) + krb5_free_keyblock(context, auth_context->send_subkey); if ((retval = krb5_generate_subkey(context, keyblock, &auth_context->send_subkey))) return retval; + + if (auth_context->recv_subkey) + krb5_free_keyblock(context, auth_context->recv_subkey); retval = krb5_copy_keyblock(context, auth_context->send_subkey, &auth_context->recv_subkey); if (retval) { -- 2.26.2