r15839 - gnucash/trunk/src/app-utils - Free memory.

Josh Sled jsled at cvs.gnucash.org
Thu Apr 5 22:49:19 EDT 2007


Author: jsled
Date: 2007-04-05 22:49:19 -0400 (Thu, 05 Apr 2007)
New Revision: 15839
Trac: http://svn.gnucash.org/trac/changeset/15839

Modified:
   gnucash/trunk/src/app-utils/gnc-sx-instance-model.c
Log:
Free memory.


Modified: gnucash/trunk/src/app-utils/gnc-sx-instance-model.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-sx-instance-model.c	2007-04-06 02:31:28 UTC (rev 15838)
+++ gnucash/trunk/src/app-utils/gnc-sx-instance-model.c	2007-04-06 02:49:19 UTC (rev 15839)
@@ -301,13 +301,13 @@
 
     if (! parent->variable_names_parsed)
     {
-        parent->variable_names = g_hash_table_new(g_str_hash, g_str_equal);
+        parent->variable_names = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
         gnc_sx_get_variables(parent->sx, parent->variable_names);
         g_hash_table_foreach(parent->variable_names, (GHFunc)_wipe_parsed_sx_var, NULL);
         parent->variable_names_parsed = TRUE;
     }
 
-    rtn->variable_bindings = g_hash_table_new(g_str_hash, g_str_equal);
+    rtn->variable_bindings = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
     g_hash_table_foreach(parent->variable_names, _clone_sx_var_hash_entry, rtn->variable_bindings);
 
     {
@@ -498,9 +498,10 @@
 static void
 gnc_sx_instance_free(GncSxInstance *instance)
 {
-    // @fixme:
-    // variable_bindings elts + map
-    // temporal_state (iff not postponed?)
+    gnc_sx_destroy_temporal_state(instance->temporal_state);
+
+    g_hash_table_destroy(instance->variable_bindings);
+    instance->variable_bindings = NULL;
      
     g_free(instance);
 }
@@ -509,10 +510,12 @@
 gnc_sx_instances_free(GncSxInstances *instances)
 {
     GList *instance_iter;
-    // @fixme:
-    // variable_names
-    // sx = null
 
+    g_hash_table_destroy(instances->variable_names);
+    instances->variable_names = NULL;
+
+    instances->sx = NULL;
+
     for (instance_iter = instances->instance_list; instance_iter != NULL; instance_iter = instance_iter->next)
     {
         GncSxInstance *inst = (GncSxInstance*)instance_iter->data;



More information about the gnucash-changes mailing list