gnucash maint: Free the libofx contexts that gnc_file_ofx_import_process_file gets.
Mike Alexander
mta at code.gnucash.org
Sat Jul 18 02:53:04 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/e3029214 (commit)
from https://github.com/Gnucash/gnucash/commit/b07d0932 (commit)
commit e302921404917806a73b0180fcd78ac7b6cffa64
Author: Mike Alexander <mta at umich.edu>
Date: Mon Jul 13 18:12:51 2020 -0400
Free the libofx contexts that gnc_file_ofx_import_process_file gets.
It allocates one per file plus one that is unused and
never frees any of them.
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index 0e8e1816c..405d069ca 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -1118,7 +1118,7 @@ reconcile_when_close_toggled_cb (GtkToggleButton *togglebutton, ofx_info* info)
static void
gnc_file_ofx_import_process_file (ofx_info* info)
{
- LibofxContextPtr libofx_context = libofx_get_new_context();
+ LibofxContextPtr libofx_context;
char* filename = NULL;
char * selected_filename = NULL;
GtkWindow *parent = info->parent;
@@ -1127,6 +1127,7 @@ gnc_file_ofx_import_process_file (ofx_info* info)
return;
filename = info->file_list->data;
+ libofx_context = libofx_get_new_context();
#ifdef G_OS_WIN32
selected_filename = g_win32_locale_filename_from_utf8 (filename);
@@ -1150,6 +1151,9 @@ gnc_file_ofx_import_process_file (ofx_info* info)
// Create the match dialog, and run the ofx file through the importer.
info->gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, TRUE, 42, FALSE);
libofx_proc_file (libofx_context, selected_filename, AUTODETECT);
+
+ // Free the libofx context before recursing to process the next file
+ libofx_free_context(libofx_context);
// See whether the view has anything in it and warn the user if not.
if(gnc_gen_trans_list_empty (info->gnc_ofx_importer_gui))
@@ -1191,7 +1195,6 @@ void gnc_file_ofx_import (GtkWindow *parent)
extern int ofx_STATUS_msg;
GSList* selected_filenames = NULL;
char *default_dir;
- LibofxContextPtr libofx_context = libofx_get_new_context();
GList *filters = NULL;
GSList* iter = NULL;
ofx_info* info = NULL;
Summary of changes:
gnucash/import-export/ofx/gnc-ofx-import.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list