gnucash stable: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Mon Sep 18 20:03:25 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/d21698f7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/55b9382a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/01f27e9c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fccf0b48 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a8c3b4b0 (commit)



commit d21698f7cf6d6272c357cd431fb8812277715713
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Sep 18 22:27:43 2023 +0800

    [gnc-option-impl] don't leak char*
    
    use the stack

diff --git a/libgnucash/engine/gnc-option-impl.cpp b/libgnucash/engine/gnc-option-impl.cpp
index bb34a6553f..b60b18a2ae 100644
--- a/libgnucash/engine/gnc-option-impl.cpp
+++ b/libgnucash/engine/gnc-option-impl.cpp
@@ -839,12 +839,14 @@ GncOptionAccountListValue::serialize() const noexcept
     bool first = true;
     if (m_value.empty())
         return no_value;
+    gchar guidstr[GUID_ENCODING_LENGTH + 1];
     for (auto val : m_value)
     {
         if (!first)
             retval += " ";
         first = false;
-        retval += guid_to_string(&val);
+        guid_to_string_buff (&val, guidstr);
+        retval += guidstr;
     }
     return retval;
 }

commit 55b9382ad94d11db79052d261877dd648dce972b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Sep 18 22:27:20 2023 +0800

    [utest-gnc-backend-sql] properly clean up QofBook

diff --git a/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp b/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
index a288cc17b6..19f24595f6 100644
--- a/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
+++ b/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
@@ -329,7 +329,7 @@ test_gnc_sql_commit_edit (void)
 
     g_log_remove_handler (logdomain, hdlr1);
     g_object_unref (inst);
-    g_object_unref (book);
+    qof_book_destroy (book);
     delete sql_be;
 }
 /* handle_and_term

commit 01f27e9c5385599b63d18b1dbcb3e772fb357763
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Sep 18 22:27:03 2023 +0800

    [test-commodities] clean up commodities

diff --git a/libgnucash/engine/test/test-commodities.cpp b/libgnucash/engine/test/test-commodities.cpp
index 7ed5871678..09ce302fb3 100644
--- a/libgnucash/engine/test/test-commodities.cpp
+++ b/libgnucash/engine/test/test-commodities.cpp
@@ -136,6 +136,8 @@ test_commodity(void)
         do_test(
             gnc_commodity_equiv(com, com2), "commodity equiv");
 
+        gnc_commodity_destroy (com2);
+        gnc_commodity_destroy (com);
         qof_book_destroy (book);
     }
 
@@ -188,6 +190,8 @@ test_commodity(void)
                     tbl, gnc_commodity_get_namespace(coms[i])),
                 "test have namespace");
         }
+        gnc_commodity_table_destroy (tbl);
+        qof_book_destroy (book);
     }
 
 }

commit fccf0b48c4e612c423d491637eacb22886844c22
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Sep 18 22:26:35 2023 +0800

    [utest-Account] g_free char*

diff --git a/libgnucash/engine/test/utest-Account.cpp b/libgnucash/engine/test/utest-Account.cpp
index eda6aef630..e09e5426b8 100644
--- a/libgnucash/engine/test/utest-Account.cpp
+++ b/libgnucash/engine/test/utest-Account.cpp
@@ -1346,24 +1346,30 @@ static void
 test_gnc_account_get_map_entry (Fixture *fixture, gconstpointer pData)
 {
     Account *account = xaccMallocAccount (gnc_account_get_book (fixture->acct));
-
+    char *entry;
     g_assert_cmpstr (gnc_account_get_map_entry (account, "one", NULL), ==, nullptr);
     g_assert_cmpstr (gnc_account_get_map_entry (account, "one", "two"), ==, nullptr);
 
     set_kvp_string_path (account, {"one"}, "uno");
-    g_assert_cmpstr (gnc_account_get_map_entry (account, "one", NULL), ==, "uno");
+    entry = gnc_account_get_map_entry (account, "one", NULL);
+    g_assert_cmpstr (entry, ==, "uno");
     g_assert_cmpstr (gnc_account_get_map_entry (account, "one", "two"), ==, nullptr);
+    g_free (entry);
 
     set_kvp_string_path (account, {"one", "two"}, "dos");
     g_assert_cmpstr (gnc_account_get_map_entry (account, "one", "tw0"), ==, nullptr);
-    g_assert_cmpstr (gnc_account_get_map_entry (account, "one", "two"), ==, "dos");
+    entry = gnc_account_get_map_entry (account, "one", "two");
+    g_assert_cmpstr (entry, ==, "dos");
+    g_free (entry);
 
     set_kvp_string_path (account, {"one"}, nullptr);
     g_assert_cmpstr (gnc_account_get_map_entry (account, "one", NULL), ==, nullptr);
     g_assert_cmpstr (gnc_account_get_map_entry (account, "one", "two"), ==, nullptr);
 
     set_kvp_string_path (account, {"one", "two"}, "dos");
-    g_assert_cmpstr (gnc_account_get_map_entry (account, "one", "two"), ==, "dos");
+    entry = gnc_account_get_map_entry (account, "one", "two");
+    g_assert_cmpstr (entry, ==, "dos");
+    g_free (entry);
 
     xaccAccountBeginEdit (account);
     xaccAccountDestroy (account);



Summary of changes:
 libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp |  2 +-
 libgnucash/engine/gnc-option-impl.cpp                 |  4 +++-
 libgnucash/engine/test/test-commodities.cpp           |  4 ++++
 libgnucash/engine/test/utest-Account.cpp              | 14 ++++++++++----
 4 files changed, 18 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list