gnucash maint: [gnc-xml-backend.cpp] gchar* must be freed after use.
Christopher Lam
clam at code.gnucash.org
Sun Mar 20 19:27:35 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/4a75baa4 (commit)
from https://github.com/Gnucash/gnucash/commit/7fbbd6e7 (commit)
commit 4a75baa4c6772d3a864455e50c323a38c228af9c
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Mar 20 23:12:32 2022 +0800
[gnc-xml-backend.cpp] gchar* must be freed after use.
It is used as a constructor for std::string which makes a copy but
doesn't take ownership.
diff --git a/libgnucash/backend/xml/gnc-xml-backend.cpp b/libgnucash/backend/xml/gnc-xml-backend.cpp
index 5afe3fa0a..03cc9b9b0 100644
--- a/libgnucash/backend/xml/gnc-xml-backend.cpp
+++ b/libgnucash/backend/xml/gnc-xml-backend.cpp
@@ -116,7 +116,9 @@ GncXmlBackend::session_begin(QofSession* session, const char* new_uri,
SessionOpenMode mode)
{
/* Make sure the directory is there */
- m_fullpath = gnc_uri_get_path (new_uri);
+ auto path_str = gnc_uri_get_path (new_uri);
+ m_fullpath = path_str;
+ g_free (path_str);
if (m_fullpath.empty())
{
Summary of changes:
libgnucash/backend/xml/gnc-xml-backend.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list