From 90804dcdc3c4b1a32372c430d7cbe351e2e2287e Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Tue, 19 Jul 2022 00:02:41 +0800 Subject: [PATCH] [import-backend] plug memory leak with duplicate FITIDs addendum to 579ba4431... if there are splits with duplicate FITID in the hash, free the char* --- gnucash/import-export/import-backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnucash/import-export/import-backend.c b/gnucash/import-export/import-backend.c index 52f6e103c1..4f4f5234cd 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); } } }