From 9e4694157b9b36d9690046bb7e520bf1fc86eb5e Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Tue, 3 Aug 1999 16:40:23 +0000 Subject: [PATCH] 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 --- src/lib/krb5/ccache/ccapi/stdcc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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); } -- 2.26.2