From: John Kohl Date: Thu, 3 May 1990 18:31:14 +0000 (+0000) Subject: fix some confusion about when to release data X-Git-Tag: krb5-1.0-alpha2~683 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6972a06d6c1773d61601231295641d9564e660f3;p=krb5.git fix some confusion about when to release data git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@714 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/mk_req_ext.c b/src/lib/krb5/krb/mk_req_ext.c index bbfc4b2e0..3108e7611 100644 --- a/src/lib/krb5/krb/mk_req_ext.c +++ b/src/lib/krb5/krb/mk_req_ext.c @@ -76,6 +76,7 @@ krb5_data *outbuf; krb5_data *scratch; krb5_enctype etype; krb5_encrypt_block eblock; + krb5_data *toutbuf; if ((ap_req_options & AP_OPTS_USE_SESSION_KEY) && !creds->ticket.length) @@ -110,9 +111,10 @@ krb5_data *outbuf; } /* encode it before encrypting */ retval = encode_krb5_authenticator(&authent, &scratch); - cleanup_ticket(); - if (retval) + if (retval) { + cleanup_ticket(); return(retval); + } #define cleanup_scratch() { (void) bzero(scratch->data, scratch->length); krb5_free_data(scratch); } @@ -152,10 +154,13 @@ krb5_data *outbuf; return retval; } - retval = encode_krb5_ap_req(&request, &outbuf); + if (!(retval = encode_krb5_ap_req(&request, &toutbuf))) { + *outbuf = *toutbuf; + xfree(toutbuf); + } + cleanup_ticket(); cleanup_encpart(); - if (retval) - return(retval); + return retval; clean_prockey: cleanup_prockey();