r20003 - gnucash/trunk/src/bin - Plug more memory leaks

Phil Longstaff plongstaff at code.gnucash.org
Thu Dec 30 10:53:07 EST 2010


Author: plongstaff
Date: 2010-12-30 10:53:07 -0500 (Thu, 30 Dec 2010)
New Revision: 20003
Trac: http://svn.gnucash.org/trac/changeset/20003

Modified:
   gnucash/trunk/src/bin/gnucash-bin.c
Log:
Plug more memory leaks


Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2010-12-30 15:51:32 UTC (rev 20002)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2010-12-30 15:53:07 UTC (rev 20003)
@@ -216,7 +216,10 @@
     g_free (config_path);
     g_free (env_file);
     if ( !got_keyfile )
+    {
+        g_key_file_free(keyfile);
         return;
+    }
 
     /* Read the environment overrides and apply them */
     env_vars = g_key_file_get_keys(keyfile, "Variables", &param_count, &error);
@@ -242,6 +245,7 @@
                 gchar *expanded = environment_expand (val_list[j]);
                 new_val = g_build_path (G_SEARCHPATH_SEPARATOR_S, tmp_val, expanded, NULL);
                 g_free (tmp_val);
+                g_free(expanded);
                 tmp_val = new_val;
             }
             g_strfreev (val_list);
@@ -254,11 +258,12 @@
             if (!g_setenv (env_vars[i], new_val, TRUE))
                 g_warning ("Couldn't properly override environment variable \"%s\". "
                            "This may lead to unexpected results", env_vars[i]);
+            g_free(new_val);
         }
     }
 
     g_strfreev(env_vars);
-
+    g_key_file_free(keyfile);
 }
 
 #ifdef MAC_INTEGRATION



More information about the gnucash-changes mailing list