gnucash stable: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Fri Sep 15 20:43:05 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/a81bc72f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/94211c2e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/14622e7d (commit)
	from  https://github.com/Gnucash/gnucash/commit/96a63f92 (commit)



commit a81bc72fb17e2dc34b0ad013ee4a1c36172f9c0e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Sep 16 06:21:25 2023 +0800

    [test-sx] plug some leaks

diff --git a/libgnucash/app-utils/test/test-sx.cpp b/libgnucash/app-utils/test/test-sx.cpp
index dee35ca12c..163a38e06c 100644
--- a/libgnucash/app-utils/test/test-sx.cpp
+++ b/libgnucash/app-utils/test/test-sx.cpp
@@ -138,6 +138,8 @@ test_once()
     g_object_unref(model);
     success("model unref");
     remove_sx(lonely);
+    g_date_free (when);
+    g_date_free (end);
 }
 
 static GncSxInstance*
@@ -215,6 +217,8 @@ test_state_changes()
 
     g_object_unref(model);
     remove_sx(foo);
+    g_date_free (start);
+    g_date_free (end);
 }
 
 static void

commit 94211c2e5761f3d8843eeb1b33b1f655459fc686
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Sep 16 05:50:18 2023 +0800

    [test-sx] plug some leaks

diff --git a/libgnucash/app-utils/test/test-sx.cpp b/libgnucash/app-utils/test/test-sx.cpp
index 04b7468ed0..dee35ca12c 100644
--- a/libgnucash/app-utils/test/test-sx.cpp
+++ b/libgnucash/app-utils/test/test-sx.cpp
@@ -241,6 +241,7 @@ make_one_transaction_end(TTInfo **tti, SchedXaction *sx)
     xaccSchedXactionSetTemplateTrans(sx, txns, book);
     gnc_ttinfo_free(*tti);
     *tti = NULL;
+    g_list_free (txns);
 }
 
 static void

commit 14622e7db65adc8025adf55ca7157f140b0064cb
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Sep 16 05:44:48 2023 +0800

    [test-print-parse-amount] plug leaks

diff --git a/libgnucash/app-utils/test/test-print-parse-amount.cpp b/libgnucash/app-utils/test/test-print-parse-amount.cpp
index a4ab4683e6..1a71d6e729 100644
--- a/libgnucash/app-utils/test/test-print-parse-amount.cpp
+++ b/libgnucash/app-utils/test/test-print-parse-amount.cpp
@@ -44,14 +44,19 @@ test_num_print_info (gnc_numeric n, GNCPrintAmountInfo print_info, int line)
 
     ok = xaccParseAmount (s, print_info.monetary, &n_parsed, NULL);
 
+    gchar *n_str = gnc_numeric_to_string (n);
+    gchar *n_parsed_str = gnc_numeric_to_string (n_parsed);
+
     do_test_args (ok, "parsing failure", __FILE__, __LINE__,
-                  "num: %s, string %s (line %d)", gnc_numeric_to_string (n), s, line);
+                  "num: %s, string %s (line %d)", n_str, s, line);
 
     ok = gnc_numeric_equal (n, n_parsed);
     do_test_args (ok, "not equal", __FILE__, __LINE__,
                   "start: %s, string %s, finish: %s (line %d)",
-                  gnc_numeric_to_string (n), s,
-                  gnc_numeric_to_string (n_parsed), line);
+                  n_str, s, n_parsed_str, line);
+
+    g_free (n_parsed_str);
+    g_free (n_str);
 }
 
 static void
@@ -80,9 +85,11 @@ test_num (gnc_numeric n)
                                   GNC_HOW_RND_ROUND_HALF_UP);
         if (gnc_numeric_check(n1))
         {
+            gchar *n_str = gnc_numeric_to_string(n);
             do_test_args((gnc_numeric_check(n1) == GNC_ERROR_OVERFLOW),
                          "BAD NUMERIC CONVERSION", __FILE__, __LINE__,
-                         "num: %s, fraction: %d", gnc_numeric_to_string(n), fraction);
+                         "num: %s, fraction: %d", n_str, fraction);
+            g_free (n_str);
             continue;
         }
 
@@ -108,11 +115,14 @@ test_num (gnc_numeric n)
 
 #define IS_VALID_NUM(n,m)                                               \
     if (gnc_numeric_check(n)) {                                         \
+        n_str = gnc_numeric_to_string(n);                               \
+        m_str = gnc_numeric_to_string(m);                               \
         do_test_args(gnc_numeric_check(n) == GNC_ERROR_OVERFLOW,        \
                      "BAD NUMERIC", __FILE__, __LINE__,                 \
                      "num: %s (from %s)",                               \
-                     gnc_numeric_to_string(n),                          \
-                     gnc_numeric_to_string(m));                         \
+                     n_str, m_str);                                     \
+        g_free (m_str);                                                 \
+        g_free (n_str);                                                 \
         continue;                                                       \
     } else { m = n; }
 
@@ -139,6 +149,7 @@ run_tests (void)
     {
         gnc_numeric n;
         gnc_numeric n1;
+        gchar *m_str, *n_str;
 
         n = get_random_gnc_numeric (GNC_DENOM_AUTO);
         IS_VALID_NUM(n, n);
@@ -155,6 +166,9 @@ run_tests (void)
     }
     g_log_remove_handler (log_domain, hdlr);
     test_clear_error_list();
+    test_error_struct_free (check3);
+    test_error_struct_free (check2);
+    test_error_struct_free (check1);
 }
 
 int



Summary of changes:
 .../app-utils/test/test-print-parse-amount.cpp     | 26 +++++++++++++++++-----
 libgnucash/app-utils/test/test-sx.cpp              |  5 +++++
 2 files changed, 25 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list