gnucash stable: [io-gncxml-v2.cpp] xmlGetProp must be xmlFreed
Christopher Lam
clam at code.gnucash.org
Sun Dec 21 01:55:47 EST 2025
Updated via https://github.com/Gnucash/gnucash/commit/f893b046 (commit)
from https://github.com/Gnucash/gnucash/commit/3a066029 (commit)
commit f893b046fb81447cc92dbce16166c22c79bd59a6
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Dec 21 12:45:55 2025 +0800
[io-gncxml-v2.cpp] xmlGetProp must be xmlFreed
diff --git a/libgnucash/backend/xml/io-gncxml-v2.cpp b/libgnucash/backend/xml/io-gncxml-v2.cpp
index 3265ae2929..9d6e23764e 100644
--- a/libgnucash/backend/xml/io-gncxml-v2.cpp
+++ b/libgnucash/backend/xml/io-gncxml-v2.cpp
@@ -1103,8 +1103,10 @@ write_pricedb (FILE* out, QofBook* book, sixtp_gdv2* gd)
We do it this way instead of just calling xmlElemDump so that we can
increment the progress bar as we go. */
- if (fprintf (out, "<%s version=\"%s\">\n", parent->name,
- xmlGetProp (parent, BAD_CAST "version")) < 0)
+ auto version_str = xmlGetProp (parent, BAD_CAST "version");
+ auto res = fprintf (out, "<%s version=\"%s\">\n", parent->name, version_str);
+ xmlFree (version_str);
+ if (res < 0)
return FALSE;
/* We create our own output buffer so we can call xmlNodeDumpOutput to get
Summary of changes:
libgnucash/backend/xml/io-gncxml-v2.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list