gnucash stable: [sixtp-dom-parsers.cpp] g_date_free GDate leak

Christopher Lam clam at code.gnucash.org
Wed Dec 17 19:30:14 EST 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/4f655492 (commit)
	from  https://github.com/Gnucash/gnucash/commit/92144137 (commit)



commit 4f655492cef214b3a6d6033adc05091eab791ccd
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Dec 18 08:28:53 2025 +0800

    [sixtp-dom-parsers.cpp] g_date_free GDate leak
    
    missed out on refactor. previous code incorrectly used g_free.

diff --git a/libgnucash/backend/xml/sixtp-dom-parsers.cpp b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
index 4f62bebdb2..df4a7d2cf4 100644
--- a/libgnucash/backend/xml/sixtp-dom-parsers.cpp
+++ b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
@@ -176,7 +176,10 @@ static KvpValue*
 dom_tree_to_gdate_kvp_value (xmlNodePtr node)
 {
     auto date = dom_tree_to_gdate (node);
-    return date ? new KvpValue {*date} : nullptr;
+    if (!date) return nullptr;
+    auto rv{new KvpValue {*date}};
+    g_date_free (date);
+    return rv;
 }
 
 gboolean



Summary of changes:
 libgnucash/backend/xml/sixtp-dom-parsers.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list