AUDIT: r17039 - gnucash/trunk/src - Fix memory leaks in gnc_tree_view_account_restore() and gnc_commodity_find_currency().

Andreas Köhler andi5 at cvs.gnucash.org
Thu Mar 20 19:15:04 EDT 2008


Author: andi5
Date: 2008-03-20 19:15:04 -0400 (Thu, 20 Mar 2008)
New Revision: 17039
Trac: http://svn.gnucash.org/trac/changeset/17039

Modified:
   gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
   gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
Log:
Fix memory leaks in gnc_tree_view_account_restore() and gnc_commodity_find_currency().

BP


Modified: gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2008-03-20 23:14:55 UTC (rev 17038)
+++ gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2008-03-20 23:15:04 UTC (rev 17039)
@@ -227,10 +227,18 @@
     }
 
     if (!exchange || !mnemonic)
+    {
+      if (exchange) xmlFree(exchange);
+      if (mnemonic) xmlFree(mnemonic);
       return NULL;
+    }
 
     if (!gnc_commodity_namespace_is_iso(exchange))
+    {
+      xmlFree(exchange);
+      xmlFree(mnemonic);
       return NULL;
+    }
 
     table = gnc_commodity_table_get_table(book);
     return gnc_commodity_table_lookup(table, exchange, mnemonic);

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2008-03-20 23:14:55 UTC (rev 17038)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2008-03-20 23:15:04 UTC (rev 17039)
@@ -2086,6 +2086,7 @@
                 tree_restore_expanded_row(view, value);
                 g_free(value);
 	    }
+            g_free(key);
         }
     } else {
         g_warning("error reading group %s key %s: %s",



More information about the gnucash-changes mailing list