gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Thu Sep 9 19:36:30 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/8ab8642e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1387d5f9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d4bd6005 (commit)
	from  https://github.com/Gnucash/gnucash/commit/140922a3 (commit)



commit 8ab8642e76466e1af2c381dfa64b5bb3409f2a9e
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 9 16:02:00 2021 -0700

    Fix leak of trading_splits list in xaccTransClearTradingSplits

diff --git a/libgnucash/engine/Scrub.c b/libgnucash/engine/Scrub.c
index 888378cde..de14940e4 100644
--- a/libgnucash/engine/Scrub.c
+++ b/libgnucash/engine/Scrub.c
@@ -612,7 +612,7 @@ gnc_transaction_get_commodity_imbalance (Transaction *trans,
 
 /* GFunc wrapper for xaccSplitDestroy */
 static void
-destroy_split (void* ptr, void* data)
+destroy_split (void* ptr)
 {
     Split *split = GNC_SPLIT (ptr);
     if (split)
@@ -642,7 +642,10 @@ xaccTransClearTradingSplits (Transaction *trans)
         return;
 
     xaccTransBeginEdit (trans);
-    g_list_foreach (trading_splits, destroy_split, NULL);
+    /* destroy_splits doesn't actually free the splits but this gets
+     * the list ifself freed.
+     */
+    g_list_free_full (trading_splits, destroy_split);
     xaccTransCommitEdit (trans);
 }
 

commit 1387d5f960255feeeb7a2a63ce3f7119385e69cc
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 9 15:58:47 2021 -0700

    Fix unchecked ptr dereference.
    
    First crash in Bug 798225.

diff --git a/libgnucash/engine/gncTaxTable.c b/libgnucash/engine/gncTaxTable.c
index 3cd689db5..2e0cbfa90 100644
--- a/libgnucash/engine/gncTaxTable.c
+++ b/libgnucash/engine/gncTaxTable.c
@@ -704,7 +704,7 @@ GncTaxTableList * gncTaxTableGetTables (QofBook *book)
     if (!book) return NULL;
 
     bi = qof_book_get_data (book, _GNC_MOD_NAME);
-    return bi->tables;
+    return bi ? bi->tables : NULL;
 }
 
 const char *gncTaxTableGetName (const GncTaxTable *table)

commit d4bd60059614cbe980bef100476fa8d044ee805d
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 9 15:58:19 2021 -0700

    Fix free-of-unallocated-address crash due to uninitialized ptr.

diff --git a/gnucash/gnome/gnc-plugin-report-system.c b/gnucash/gnome/gnc-plugin-report-system.c
index 3016f9937..621f00131 100644
--- a/gnucash/gnome/gnc-plugin-report-system.c
+++ b/gnucash/gnome/gnc-plugin-report-system.c
@@ -136,10 +136,10 @@ gnc_report_system_file_stream_cb (const char *location, char ** data, int *len)
 static gboolean
 gnc_report_system_report_stream_cb (const char *location, char ** data, int *len)
 {
-    gboolean ok;
-    gchar *captured_str;
-
-    ok = gnc_run_report_id_string_with_error_handling (location, data, &captured_str);
+    gchar *captured_str = NULL;
+    gboolean ok =
+         gnc_run_report_id_string_with_error_handling (location, data,
+                                                       &captured_str);
 
     if (!ok)
     {



Summary of changes:
 gnucash/gnome/gnc-plugin-report-system.c | 8 ++++----
 libgnucash/engine/Scrub.c                | 7 +++++--
 libgnucash/engine/gncTaxTable.c          | 2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list