gnucash maint: Bug 798629 - gnucash crashes attempting to import OFX file
Christopher Lam
clam at code.gnucash.org
Fri Oct 7 10:11:00 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/14fe4d86 (commit)
from https://github.com/Gnucash/gnucash/commit/8193d7f2 (commit)
commit 14fe4d862f9cd797fb947bc20403b9cf4bb9eece
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Oct 7 22:02:35 2022 +0800
Bug 798629 - gnucash crashes attempting to import OFX file
It's not correct to g_free id if the g_hash_table_insert returns
FALSE; returning FALSE means the key/value pair was replaced. The key
will automatically be freed by glib thanks to the new_hash having a
GDestroyNotify g_free:
GHashTable* new_hash = g_hash_table_new_full
(g_str_hash, g_str_equal, g_free, NULL);
diff --git a/gnucash/import-export/import-backend.c b/gnucash/import-export/import-backend.c
index b84316483..14a1da107 100644
--- a/gnucash/import-export/import-backend.c
+++ b/gnucash/import-export/import-backend.c
@@ -1219,8 +1219,7 @@ 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);
- if (!g_hash_table_insert (new_hash, (void*) id, GINT_TO_POINTER (1)))
- g_free (id);
+ g_hash_table_insert (new_hash, (void*) id, GINT_TO_POINTER (1));
}
}
}
Summary of changes:
gnucash/import-export/import-backend.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
More information about the gnucash-changes
mailing list