gnucash stable: Bug 799283 - Segfault/Crash if payment dialog change from customer to vendor
John Ralls
jralls at code.gnucash.org
Tue Oct 15 14:55:08 EDT 2024
Updated via https://github.com/Gnucash/gnucash/commit/409cd0de (commit)
from https://github.com/Gnucash/gnucash/commit/f5568812 (commit)
commit 409cd0dec1421ba69878454d52daead056493c5f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Oct 15 11:51:59 2024 -0700
Bug 799283 - Segfault/Crash if payment dialog change from customer to vendor
Always take ownership of the text string.
diff --git a/gnucash/gnome/business-gnome-utils.c b/gnucash/gnome/business-gnome-utils.c
index 835b22b39f..4715337560 100644
--- a/gnucash/gnome/business-gnome-utils.c
+++ b/gnucash/gnome/business-gnome-utils.c
@@ -450,14 +450,14 @@ gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
GtkListStore *store;
GtkTreeIter iter;
GList *list, *node;
- const gchar *text;
g_return_val_if_fail (combo && GTK_IS_COMBO_BOX(combo), NULL);
g_return_val_if_fail (book, NULL);
g_return_val_if_fail (acct_types, NULL);
/* Figure out if anything is set in the combo */
- text = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(combo)))));
+ char* text =
+ g_strdup (gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(combo))))));
g_object_set_data (G_OBJECT(combo), "book", book);
list = gnc_account_get_descendants (gnc_book_get_root_account (book));
@@ -496,6 +496,7 @@ gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
/* Save the first account name in case no account name was set */
if (!text || g_strcmp0 (text, "") == 0)
{
+ g_free (text);
text = g_strdup (name);
}
g_free(name);
@@ -506,6 +507,7 @@ gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
gnc_cbwe_set_by_string(GTK_COMBO_BOX(combo), text);
+ g_free (text);
return gnc_account_select_combo_get_active (combo);
}
Summary of changes:
gnucash/gnome/business-gnome-utils.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list