diff --git a/gnucash/import-export/csv-exp/assistant-csv-export.c b/gnucash/import-export/csv-exp/assistant-csv-export.c index 72c4d565e9..0e42719ad7 100644 --- a/gnucash/import-export/csv-exp/assistant-csv-export.c +++ b/gnucash/import-export/csv-exp/assistant-csv-export.c @@ -303,7 +303,6 @@ load_settings (CsvExportInfo *info) info->separator_str = ","; info->file_name = NULL; info->starting_dir = NULL; - info->trans_list = NULL; /* The default directory for the user to select files. */ info->starting_dir = gnc_get_default_directory (GNC_PREFS_GROUP); diff --git a/gnucash/import-export/csv-exp/assistant-csv-export.h b/gnucash/import-export/csv-exp/assistant-csv-export.h index 9cb1f9af0f..bb52e4423a 100644 --- a/gnucash/import-export/csv-exp/assistant-csv-export.h +++ b/gnucash/import-export/csv-exp/assistant-csv-export.h @@ -72,7 +72,6 @@ typedef struct CsvExportType export_type; CsvExportDate csvd; CsvExportAcc csva; - GList *trans_list; Query *query; Account *account; diff --git a/gnucash/import-export/csv-exp/csv-transactions-export.c b/gnucash/import-export/csv-exp/csv-transactions-export.c index 2244a259c3..82d998235b 100644 --- a/gnucash/import-export/csv-exp/csv-transactions-export.c +++ b/gnucash/import-export/csv-exp/csv-transactions-export.c @@ -438,13 +438,14 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh ) } /* Run the query */ + GList *trans_list = NULL; for (GList *splits = qof_query_run (info->query); splits; splits = splits->next) { Split *split = splits->data; // Look for trans already exported in trans_list Transaction *trans = xaccSplitGetParent (split); - if (g_list_find (info->trans_list, trans)) + if (g_list_find (trans_list, trans)) continue; // Look for blank split @@ -498,11 +499,12 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh ) if (info->failed) break; } - info->trans_list = g_list_prepend (info->trans_list, trans); // add trans to trans_list + trans_list = g_list_prepend (trans_list, trans); } if (info->export_type == XML_EXPORT_TRANS) qof_query_destroy (info->query); + g_list_free (trans_list); } @@ -590,8 +592,6 @@ void csv_transactions_export (CsvExportInfo *info) else account_splits (info, info->account, fh); - g_list_free (info->trans_list); // free trans_list - fclose (fh); LEAVE(""); }