diff --git a/gnucash/gnome/dialog-imap-editor.c b/gnucash/gnome/dialog-imap-editor.c index 8c9d31025e..581ef2c766 100644 --- a/gnucash/gnome/dialog-imap-editor.c +++ b/gnucash/gnome/dialog-imap-editor.c @@ -647,17 +647,10 @@ get_imap_info (ImapDialog *imap_dialog, Account *acc, const gchar *category, con // First add a child entry and pass iter to add_to_store gtk_tree_store_append (GTK_TREE_STORE(imap_dialog->model), &child, &toplevel); add_to_store (imap_dialog, &child, text, imapInfo); - - // Free the members and structure - g_free (imapInfo->head); - g_free (imapInfo->category); - g_free (imapInfo->match_string); - g_free (imapInfo->count); - g_free (imapInfo); } } g_free (acc_name); - g_list_free (imap_list); // Free the List + g_list_free_full (imap_list, (GDestroyNotify)gnc_account_imap_info_destroy); // Free the List } static void diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index b0bd8a8937..1a53ff6026 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -6232,6 +6232,15 @@ build_bayes (const char *suffix, KvpValue * value, GncImapInfo & imapInfo) imapInfo.list = g_list_prepend (imapInfo.list, imap_node); } +void gnc_account_imap_info_destroy (GncImapInfo* imapInfo) +{ + g_free (imapInfo->head); + g_free (imapInfo->category); + g_free (imapInfo->match_string); + g_free (imapInfo->count); + g_free (imapInfo); +} + GList * gnc_account_imap_get_info_bayes (Account *acc) { diff --git a/libgnucash/engine/Account.h b/libgnucash/engine/Account.h index 342c236c1f..f1db851cf4 100644 --- a/libgnucash/engine/Account.h +++ b/libgnucash/engine/Account.h @@ -1611,6 +1611,11 @@ typedef enum char *count; }GncImapInfo; + /** Clean destructor for the imap_info structure of Bayesian + * mappings + */ + void gnc_account_imap_info_destroy (GncImapInfo*); + /** Returns a GList of structure imap_info of all Bayesian mappings for * required Account */