gnucash maint: [gnc-tree-view] some char* freed

Christopher Lam clam at code.gnucash.org
Wed Jul 27 09:53:12 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/2e81d444 (commit)
	from  https://github.com/Gnucash/gnucash/commit/b598375e (commit)



commit 2e81d4440262b01bbf304c9adddbac96550febed
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Jul 27 20:00:08 2022 +0800

    [gnc-tree-view] some char* freed

diff --git a/gnucash/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
index 977323704..0de60f806 100644
--- a/gnucash/gnome-utils/gnc-tree-view.c
+++ b/gnucash/gnome-utils/gnc-tree-view.c
@@ -1037,13 +1037,17 @@ gnc_tree_view_set_state_section (GncTreeView *view,
             gchar *key = keys[idx];
             if (g_strcmp0 (key, STATE_KEY_SORT_COLUMN) == 0)
             {
-                gnc_tree_view_set_sort_column (view,
-                                               g_key_file_get_string (state_file, priv->state_section, key, NULL));
+                gchar *name = g_key_file_get_string (state_file, priv->state_section,
+                                                     key, NULL);
+                gnc_tree_view_set_sort_column (view, name);
+                g_free (name);
             }
             else if (g_strcmp0 (key, STATE_KEY_SORT_ORDER) == 0)
             {
-                gnc_tree_view_set_sort_order (view,
-                                              g_key_file_get_string (state_file, priv->state_section, key, NULL));
+                gchar *name = g_key_file_get_string (state_file, priv->state_section,
+                                                     key, NULL);
+                gnc_tree_view_set_sort_order (view, name);
+                g_free (name);
             }
             else if (g_strcmp0 (key, STATE_KEY_COLUMN_ORDER) == 0)
             {



Summary of changes:
 gnucash/gnome-utils/gnc-tree-view.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list