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);
This commit is contained in:
Christopher Lam 2022-10-07 22:02:35 +08:00
parent 8193d7f23a
commit 14fe4d862f

View File

@ -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));
}
}
}