gnucash stable: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Fri Sep 15 11:34:35 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/a8dffb85 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5a03d979 (commit)
	from  https://github.com/Gnucash/gnucash/commit/3b3da080 (commit)



commit a8dffb8559fd19f93bfe842c2bf4f008289b7eb8
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Sep 15 22:24:41 2023 +0800

    [gnc-date.cpp] don't alloc tm* unless GncDateTime() succeeds
    
    because GncDateTime() may throw an exception, in which case time will
    leak. mainly leaks in test suite.

diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp
index d7ae1a3dca..c44912efa7 100644
--- a/libgnucash/engine/gnc-date.cpp
+++ b/libgnucash/engine/gnc-date.cpp
@@ -187,8 +187,8 @@ gnc_gmtime (const time64 *secs)
 {
     try
     {
-        auto time = static_cast<struct tm*>(calloc(1, sizeof(struct tm)));
         GncDateTime gncdt(*secs);
+        auto time = static_cast<struct tm*>(calloc(1, sizeof(struct tm)));
         *time = gncdt.utc_tm();
         return time;
     }

commit 5a03d9798c99a0c83ef694838eb8ac9ad80ff412
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Sep 15 23:05:51 2023 +0800

    [gnc-sx-instance-model] g_free char*

diff --git a/libgnucash/app-utils/gnc-sx-instance-model.c b/libgnucash/app-utils/gnc-sx-instance-model.c
index 4f4f778917..e343f6649a 100644
--- a/libgnucash/app-utils/gnc-sx-instance-model.c
+++ b/libgnucash/app-utils/gnc-sx-instance-model.c
@@ -368,6 +368,7 @@ _get_vars_helper(Transaction *txn, void *var_hash_data)
             var_name = var_name_from_commodities(split_cmdty, txn_cmdty);
             var = gnc_sx_variable_new(var_name);
             g_hash_table_insert(var_hash, g_strdup(var->name), var);
+            g_free (var_name);
         }
     }
 



Summary of changes:
 libgnucash/app-utils/gnc-sx-instance-model.c | 1 +
 libgnucash/engine/gnc-date.cpp               | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list