gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Fri Aug 13 08:10:58 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/e4d808e6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6fd19f2e (commit)
	from  https://github.com/Gnucash/gnucash/commit/5ced0d93 (commit)



commit e4d808e674aab417698537864212b84d01848cdc
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Aug 13 08:54:21 2021 +0800

    [qofbook] qof_book_use_split_action_for_num_field: free a char*
    
    qof_instance_get allocates a new char* which must be freed.

diff --git a/libgnucash/engine/qofbook.cpp b/libgnucash/engine/qofbook.cpp
index adb1ff790..9d3925adf 100644
--- a/libgnucash/engine/qofbook.cpp
+++ b/libgnucash/engine/qofbook.cpp
@@ -1051,7 +1051,7 @@ qof_book_use_split_action_for_num_field (const QofBook *book)
     {
         // No cached value? Then do the expensive KVP lookup
         gboolean result;
-        const char *opt = NULL;
+        char *opt = NULL;
         qof_instance_get (QOF_INSTANCE (book),
                           PARAM_NAME_NUM_FIELD_SOURCE, &opt,
                           NULL);
@@ -1060,6 +1060,7 @@ qof_book_use_split_action_for_num_field (const QofBook *book)
             result = TRUE;
         else
             result = FALSE;
+        g_free (opt);
 
         // We need to const_cast the "book" argument into a non-const pointer,
         // but as we are dealing only with cache variables, I think this is

commit 6fd19f2eeaaf2fce26da3c0375d358c1b5364a93
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Aug 13 08:51:14 2021 +0800

    [dialog-lot-viewer] g_free a GList* properly
    
    g_list_free requires the argument is the head of a GList. Calling
    g_list_reverse makes the filtered_list points to the last
    element. Assigning filtered_list to the result of g_list_reverse
    ensures it still points to the head, allowing g_list_free to free the
    list properly.

diff --git a/gnucash/gnome/dialog-lot-viewer.c b/gnucash/gnome/dialog-lot-viewer.c
index 8413b9c1f..7bd5ebcd0 100644
--- a/gnucash/gnome/dialog-lot-viewer.c
+++ b/gnucash/gnome/dialog-lot-viewer.c
@@ -231,9 +231,10 @@ lv_show_splits_free (GNCLotViewer *lv)
             filtered_list = g_list_prepend (filtered_list, split);
         }
     }
+    filtered_list = g_list_reverse (filtered_list);
 
     /* display list */
-    gnc_split_viewer_fill(lv, lv->split_free_store, g_list_reverse (filtered_list));
+    gnc_split_viewer_fill(lv, lv->split_free_store, filtered_list);
     g_list_free (filtered_list);
 }
 



Summary of changes:
 gnucash/gnome/dialog-lot-viewer.c | 3 ++-
 libgnucash/engine/qofbook.cpp     | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list