gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Thu Aug 19 21:25:26 EDT 2021
Updated via https://github.com/Gnucash/gnucash/commit/15b8545e (commit)
via https://github.com/Gnucash/gnucash/commit/6c8af6aa (commit)
via https://github.com/Gnucash/gnucash/commit/4cf25cb7 (commit)
via https://github.com/Gnucash/gnucash/commit/c442192b (commit)
from https://github.com/Gnucash/gnucash/commit/57866eed (commit)
commit 15b8545e2f30c579000c21288039423ba37d5e42
Merge: 57866eed8 6c8af6aab
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Aug 20 09:24:33 2021 +0800
Merge branch 'maint-leaks' into maint #1113
commit 6c8af6aab168534a2bd65fb3ca6fa47fa450ef3e
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Aug 20 00:00:06 2021 +0800
[engine.i] free GSList* arg to qof_book_get_option
diff --git a/bindings/engine.i b/bindings/engine.i
index 2b567fcdb..ce114f0d2 100644
--- a/bindings/engine.i
+++ b/bindings/engine.i
@@ -275,6 +275,7 @@ Account * gnc_book_get_template_root(QofBook *book);
%typemap(in) KvpValue * " $1 = gnc_scm_to_kvp_value_ptr($input); "
%typemap(out) KvpValue * " $result = gnc_kvp_value_ptr_to_scm($1); "
%typemap(in) GSList *key_path " $1 = gnc_scm_to_gslist_string($input);"
+%typemap(freearg) GSList * "g_slist_free_full ($1, g_free);"
QofBook* qof_book_new (void);
void qof_book_options_delete (QofBook *book, GSList *key_path);
commit 4cf25cb7be27480dbfc92a0b6ebe83d288e23caf
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Thu Aug 19 22:28:02 2021 +0800
GList* from gtk_container_get_children must be freed
fix leaks
diff --git a/borrowed/goffice/go-optionmenu.c b/borrowed/goffice/go-optionmenu.c
index a145e2d38..670a92bc6 100644
--- a/borrowed/goffice/go-optionmenu.c
+++ b/borrowed/goffice/go-optionmenu.c
@@ -180,6 +180,8 @@ static void handle_menu_signals(GOOptionMenu *option_menu, gboolean connect)
}
}
+
+ g_list_free (children);
}
void go_option_menu_set_menu(GOOptionMenu *option_menu, GtkWidget *menu)
@@ -233,8 +235,9 @@ void go_option_menu_set_history(GOOptionMenu *option_menu, GSList *selection)
while (1)
{
int n = GPOINTER_TO_INT(selection->data);
- GtkMenuItem *item = g_list_nth_data(
- gtk_container_get_children(GTK_CONTAINER(menu)), n);
+ GList *children = gtk_container_get_children (GTK_CONTAINER(menu));
+ GtkMenuItem *item = g_list_nth_data (children, n);
+ g_list_free (children);
selection = selection->next;
if (selection)
menu = GTK_MENU_SHELL(gtk_menu_item_get_submenu(item));
diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 84f2c782b..0fe357c69 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -888,13 +888,12 @@ gnc_search_dialog_book_option_changed (gpointer new_val, gpointer user_data)
for (l = sw->crit_list; l; l = l->next)
{
struct _crit_data *data = l->data;
- GList *children;
+ GList *children = gtk_container_get_children (GTK_CONTAINER(data->container));
/* For each, walk the list of container children to get combo_box */
- for (children = gtk_container_get_children(GTK_CONTAINER(data->container));
- children; children = children->next)
+ for (GList *child = children; child; child = g_list_next (child))
{
- GtkWidget *combo_box = children->data;
+ GtkWidget *combo_box = child->data;
/* Get current active item if combo_box */
if (GTK_IS_COMBO_BOX(combo_box))
@@ -918,6 +917,7 @@ gnc_search_dialog_book_option_changed (gpointer new_val, gpointer user_data)
gtk_widget_show_all (data->container);
}
}
+ g_list_free (children);
}
gtk_widget_grab_focus(focused_widget);
}
diff --git a/gnucash/gnome-utils/dialog-options.c b/gnucash/gnome-utils/dialog-options.c
index e3f9d27e6..c4f081826 100644
--- a/gnucash/gnome-utils/dialog-options.c
+++ b/gnucash/gnome-utils/dialog-options.c
@@ -3537,12 +3537,9 @@ gnc_option_set_ui_value_radiobutton (GNCOption *option, gboolean use_default,
g_list_free(list);
list = gtk_container_get_children (GTK_CONTAINER(box));
- for (i = 0; i < index && list; i++)
- list = list->next;
- g_return_val_if_fail (list, TRUE);
-
- button = list->data;
+ button = g_list_nth_data (list, index);
g_list_free (list);
+ g_return_val_if_fail (button, TRUE);
val = g_object_get_data (G_OBJECT(button), "gnc_radiobutton_index");
g_return_val_if_fail (GPOINTER_TO_INT(val) == index, TRUE);
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index f9ceea985..45dd06253 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -2493,14 +2493,15 @@ main_window_update_page_set_read_only_icon (GncPluginPage *page,
if (GTK_IS_EVENT_BOX(tab_widget))
tab_widget = gtk_bin_get_child (GTK_BIN(tab_widget));
+ children = gtk_container_get_children (GTK_CONTAINER(tab_widget));
/* For each, walk the list of container children to get image widget */
- for (children = gtk_container_get_children (GTK_CONTAINER(tab_widget));
- children; children = children->next)
+ for (GList *child = children; child; child = g_list_next (child))
{
- GtkWidget *widget = children->data;
+ GtkWidget *widget = child->data;
if (GTK_IS_IMAGE(widget))
image = widget;
}
+ g_list_free (children);
if (!image)
{
commit c442192bb40ea05b88c275b9a176f92891f3ea56
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Aug 15 17:03:08 2021 +0800
[gnc-amount-edit] g_free char* empty string.
1 byte is allocated if filtered_string is the empty string. free it.
diff --git a/gnucash/gnome-utils/gnc-amount-edit.c b/gnucash/gnome-utils/gnc-amount-edit.c
index 61ad6fa88..9917925b1 100644
--- a/gnucash/gnome-utils/gnc-amount-edit.c
+++ b/gnucash/gnome-utils/gnc-amount-edit.c
@@ -386,6 +386,7 @@ gnc_amount_edit_expr_is_valid (GNCAmountEdit *gae, gnc_numeric *amount,
if (!filtered_string || *filtered_string == '\0')
{
*amount = gnc_numeric_zero ();
+ g_free (filtered_string);
if (empty_ok)
return -1; /* indicate an empty field */
else
Summary of changes:
bindings/engine.i | 1 +
borrowed/goffice/go-optionmenu.c | 7 +++++--
gnucash/gnome-search/dialog-search.c | 8 ++++----
gnucash/gnome-utils/dialog-options.c | 7 ++-----
gnucash/gnome-utils/gnc-amount-edit.c | 1 +
gnucash/gnome-utils/gnc-main-window.c | 7 ++++---
6 files changed, 17 insertions(+), 14 deletions(-)
More information about the gnucash-changes
mailing list