gnucash maint: Close some memory leaks identified by valgrind.

Phil Longstaff plongstaff at code.gnucash.org
Sun Feb 28 09:22:28 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/40c543ef (commit)
	from  https://github.com/Gnucash/gnucash/commit/acdd5d02 (commit)



commit 40c543ef2166d0300121a0370343d4e2e9892c73
Author: Phil Longstaff <phil.longstaff at yahoo.ca>
Date:   Sun Feb 28 00:20:55 2016 -0500

    Close some memory leaks identified by valgrind.

diff --git a/src/app-utils/gnc-gsettings.c b/src/app-utils/gnc-gsettings.c
index 92672cd..c40e147 100644
--- a/src/app-utils/gnc-gsettings.c
+++ b/src/app-utils/gnc-gsettings.c
@@ -109,6 +109,8 @@ static GSettings * gnc_gsettings_get_schema_ptr (const gchar *schema_str)
             PWARN ("Ignoring attempt to access unknown gsettings schema %s", full_name);
     }
 
+    g_free(full_name);
+
     LEAVE("");
     return gset;
 }
diff --git a/src/core-utils/gnc-filepath-utils.c b/src/core-utils/gnc-filepath-utils.c
index 11d5ecf..edf2cc5 100644
--- a/src/core-utils/gnc-filepath-utils.c
+++ b/src/core-utils/gnc-filepath-utils.c
@@ -606,8 +606,10 @@ gnc_filepath_locate_pixmap (const gchar *name)
 {
     gchar *default_path;
     gchar *fullname;
+    gchar* pkgdatadir = gnc_path_get_pkgdatadir ();
 
-    default_path = g_build_filename (gnc_path_get_pkgdatadir (), "pixmaps", NULL);
+    default_path = g_build_filename (pkgdatadir, "pixmaps", NULL);
+    g_free(pkgdatadir);
     fullname = gnc_filepath_locate_file (default_path, name);
     g_free(default_path);
 
@@ -619,8 +621,10 @@ gnc_filepath_locate_ui_file (const gchar *name)
 {
     gchar *default_path;
     gchar *fullname;
+    gchar* pkgdatadir = gnc_path_get_pkgdatadir ();
 
-    default_path = g_build_filename (gnc_path_get_pkgdatadir (), "ui", NULL);
+    default_path = g_build_filename (pkgdatadir, "ui", NULL);
+    g_free(pkgdatadir);
     fullname = gnc_filepath_locate_file (default_path, name);
     g_free(default_path);
 
diff --git a/src/gnome-utils/gnc-tree-view.c b/src/gnome-utils/gnc-tree-view.c
index 6022d22..d63bc06 100644
--- a/src/gnome-utils/gnc-tree-view.c
+++ b/src/gnome-utils/gnc-tree-view.c
@@ -1059,6 +1059,7 @@ gnc_tree_view_set_state_section (GncTreeView *view,
                 g_free (column_name);
             }
         }
+        g_strfreev(keys);
     }
 
     /* Rebuild the column visibility menu */
diff --git a/src/gnome/gnc-plugin-page-budget.c b/src/gnome/gnc-plugin-page-budget.c
index f76f881..c23bdda 100644
--- a/src/gnome/gnc-plugin-page-budget.c
+++ b/src/gnome/gnc-plugin-page-budget.c
@@ -564,8 +564,10 @@ gnc_plugin_page_budget_recreate_page (GtkWidget *window, GKeyFile *key_file,
     }
     if (!string_to_guid(guid_str, &guid))
     {
+        g_free(guid_str);
         return NULL;
     }
+    g_free(guid_str);
 
     book = qof_session_get_book(gnc_get_current_session());
     bgt = gnc_budget_lookup(&guid, book);
diff --git a/src/gnome/gnc-split-reg2.c b/src/gnome/gnc-split-reg2.c
index a27bf2b..add4850 100644
--- a/src/gnome/gnc-split-reg2.c
+++ b/src/gnome/gnc-split-reg2.c
@@ -298,6 +298,7 @@ gsr2_create_table (GNCSplitReg2 *gsr)
 
     /* Restore the sort depth from saved state */
     model->sort_depth = g_key_file_get_integer (state_file, state_section, "sort_depth", NULL);
+    g_free(state_section);
 
     s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
     if (s_model)



Summary of changes:
 src/app-utils/gnc-gsettings.c       | 2 ++
 src/core-utils/gnc-filepath-utils.c | 8 ++++++--
 src/gnome-utils/gnc-tree-view.c     | 1 +
 src/gnome/gnc-plugin-page-budget.c  | 2 ++
 src/gnome/gnc-split-reg2.c          | 1 +
 5 files changed, 12 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list