From a1bd05c0e70d855020b0781241a475e112f5f36f Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sun, 17 Aug 2003 04:48:40 +0000 Subject: [PATCH] whoops! git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9100 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/gnc-commodity.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/engine/gnc-commodity.c b/src/engine/gnc-commodity.c index 9b9cc1fb11..57b1556eaa 100644 --- a/src/engine/gnc-commodity.c +++ b/src/engine/gnc-commodity.c @@ -1154,6 +1154,7 @@ gnc_commodity_table_remove(gnc_commodity_table * table, if (!nsp) return; g_hash_table_remove (nsp->table, comm->mnemonic); + /* XXX minor mem leak, should remove the key as well */ } /******************************************************************** @@ -1363,8 +1364,10 @@ gnc_commodity_table_add_namespace(gnc_commodity_table * table, static int ns_helper(gpointer key, gpointer value, gpointer user_data) { + GCache *str_cache = user_data; gnc_commodity * c = value; gnc_commodity_destroy(c); + g_cache_remove (str_cache, key); /* key is commodity mnemonic */ return TRUE; } @@ -1381,7 +1384,7 @@ gnc_commodity_table_delete_namespace(gnc_commodity_table * table, GCache *str_cache = gnc_engine_get_string_cache (); g_hash_table_remove(table->table, namespace); - g_hash_table_foreach_remove(ns->table, ns_helper, NULL); + g_hash_table_foreach_remove(ns->table, ns_helper, str_cache); g_hash_table_destroy(ns->table); g_cache_remove (str_cache, ns->namespace); g_free(ns); @@ -1452,7 +1455,6 @@ ct_helper(gpointer key, gpointer value, gpointer data) g_hash_table_destroy(ns->table); ns->table = NULL; g_cache_remove (str_cache, ns->namespace); - g_cache_remove (str_cache, key); g_free(ns); return TRUE; }