From: Alexandra Ellwood Date: Tue, 3 Aug 1999 16:40:23 +0000 (+0000) Subject: Fixed a memory leak in krb5_stdcc_destroy(). The destroy function was failing to... X-Git-Tag: krb5-1.1-beta1~16 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e4694157b9b36d9690046bb7e520bf1fc86eb5e;p=krb5.git Fixed a memory leak in krb5_stdcc_destroy(). The destroy function was failing to free memory allocated for the krb5_ccache. Code to free this memory was swiped from krb5_stdcc_close() git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11613 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/ccapi/stdcc.c b/src/lib/krb5/ccache/ccapi/stdcc.c index 2a7a9775f..db93102ca 100644 --- a/src/lib/krb5/ccache/ccapi/stdcc.c +++ b/src/lib/krb5/ccache/ccapi/stdcc.c @@ -614,9 +614,19 @@ krb5_stdcc_destroy (krb5_context context, krb5_ccache id) return retval; } - /* destroy the named cache */ - err = cc_destroy(gCntrlBlock, &ccapi_data->NamedCache); - cache_changed(); + /* free memory associated with the krb5_ccache */ + if (ccapi_data) { + if (ccapi_data->cache_name) + free(ccapi_data->cache_name); + if (ccapi_data->NamedCache) { + /* destroy the named cache */ + err = cc_destroy(gCntrlBlock, &ccapi_data->NamedCache); + cache_changed(); + } + free(ccapi_data); + id->data = NULL; + } + free(id); return cc_err_xlate(err); }