Fixed a memory leak in krb5_stdcc_destroy(). The destroy function was failing to...
authorAlexandra Ellwood <lxs@mit.edu>
Tue, 3 Aug 1999 16:40:23 +0000 (16:40 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Tue, 3 Aug 1999 16:40:23 +0000 (16:40 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11613 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/ccapi/stdcc.c

index 2a7a9775f84d1e6bc2d64d399273688b47451df5..db93102cad8bfe0ef826451bda3830e8a919adee 100644 (file)
@@ -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);
 }