From 75037756aaf52776daa6acbe0c5c747de0e9e115 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 23 May 2003 06:55:39 +0000 Subject: [PATCH] Memory leak in kdc etype_info2 preauth * kdc_preauth.c (return_etype_info2): After encoding the etype_info2 and copying the pointers to the pa_data, free the krb5_data pointer. Ticket: new Target_Version: 1.3 Tags: pickup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15483 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kdc/ChangeLog | 6 ++++++ src/kdc/kdc_preauth.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/kdc/ChangeLog b/src/kdc/ChangeLog index 8e13108a4..097fe7c9e 100644 --- a/src/kdc/ChangeLog +++ b/src/kdc/ChangeLog @@ -1,3 +1,9 @@ +2003-05-23 Ezra Peisach + + * kdc_preauth.c (return_etype_info2): After encoding the + etype_info2 and copying the pointers to the pa_data, free the + krb5_data pointer. + 2003-05-22 Sam Hartman * do_tgs_req.c (process_tgs_req): LOG transited check disabled as info not error diff --git a/src/kdc/kdc_preauth.c b/src/kdc/kdc_preauth.c index 963a25b7b..3dcced412 100644 --- a/src/kdc/kdc_preauth.c +++ b/src/kdc/kdc_preauth.c @@ -763,15 +763,21 @@ return_etype_info2(krb5_context context, krb5_pa_data * padata, tmp_padata->contents = scratch->data; tmp_padata->length = scratch->length; *send_pa = tmp_padata; + + /* For cleanup - we no longer own the contents of the krb5_data + * only to pointer to the krb5_data + */ + scratch->data = 0; + cleanup: if (entry) krb5_free_etype_info(context, entry); if (retval) { if (tmp_padata) free(tmp_padata); - if (scratch) - krb5_free_data(context, scratch); } + if (scratch) + krb5_free_data(context, scratch); return retval; } -- 2.26.2