gnucash maint: [import-backend] plug memory leak with duplicate FITIDs
Christopher Lam
clam at code.gnucash.org
Mon Jul 18 12:14:57 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/90804dcd (commit)
from https://github.com/Gnucash/gnucash/commit/db9b4ab2 (commit)
commit 90804dcdc3c4b1a32372c430d7cbe351e2e2287e
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Jul 19 00:02:41 2022 +0800
[import-backend] plug memory leak with duplicate FITIDs
addendum to 579ba4431... if there are splits with duplicate FITID in
the hash, free the char*
diff --git a/gnucash/import-export/import-backend.c b/gnucash/import-export/import-backend.c
index 52f6e103c..4f4f5234c 100644
--- a/gnucash/import-export/import-backend.c
+++ b/gnucash/import-export/import-backend.c
@@ -1215,8 +1215,8 @@ gboolean gnc_import_exists_online_id (Transaction *trans, GHashTable* acct_id_ha
if (gnc_import_split_has_online_id (n->data))
{
char *id = gnc_import_get_split_online_id (n->data);
- g_hash_table_insert (new_hash, (void*) id, GINT_TO_POINTER (1));
- /* note we don't want to free id yet */
+ if (!g_hash_table_insert (new_hash, (void*) id, GINT_TO_POINTER (1)))
+ g_free (id);
}
}
}
Summary of changes:
gnucash/import-export/import-backend.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list