gnucash maint: Bug 797281 - Gnucash crashes when attempting to match online accounts

John Ralls jralls at code.gnucash.org
Thu Jun 20 10:44:41 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/77564b1e (commit)
	from  https://github.com/Gnucash/gnucash/commit/58be8f6b (commit)



commit 77564b1e4384382379aeac1a63c8dfed3330792b
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Jun 20 07:43:05 2019 -0700

    Bug 797281 - Gnucash crashes when attempting to match online accounts
    
    Don't create a static string and then try to free it.

diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index 121cc0010..e40832614 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -386,7 +386,7 @@ hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data)
 static gchar *
 ab_account_longname(const GNC_AB_ACCOUNT_SPEC *ab_acc)
 {
-    gchar *bankname = "";
+    gchar *bankname = NULL;
     gchar *result = NULL;
     const char *ab_bankname, *bankcode, *subAccountId, *account_number;
 
@@ -398,7 +398,7 @@ ab_account_longname(const GNC_AB_ACCOUNT_SPEC *ab_acc)
     account_number = AB_AccountSpec_GetAccountNumber (ab_acc);
 #else
     ab_bankname = AB_Account_GetBankName(ab_acc);
-    bankname = ab_bankname ? gnc_utf8_strip_invalid_strdup(ab_bankname) : "";
+    bankname = ab_bankname ? gnc_utf8_strip_invalid_strdup(ab_bankname) : NULL;
     bankcode = AB_Account_GetBankCode(ab_acc);
     subAccountId = AB_Account_GetSubAccountId(ab_acc);
     account_number = AB_Account_GetAccountNumber (ab_acc);
@@ -406,7 +406,9 @@ ab_account_longname(const GNC_AB_ACCOUNT_SPEC *ab_acc)
     /* Translators: Strings are 1. Bank code, 2. Bank name,
      * 3. Account Number,  4. Subaccount ID                  */
     result = g_strdup_printf(_("Bank code %s (%s), Account %s (%s)"),
-                             bankcode, bankname, account_number,
+                             bankcode,
+                             bankname ? bankname : "",
+                             account_number,
                              subAccountId ? subAccountId : "");
     g_free(bankname);
 



Summary of changes:
 gnucash/import-export/aqb/assistant-ab-initial.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list