gnucash maint: [gnc-dense-cal] further GList* and char* leaks
Christopher Lam
clam at code.gnucash.org
Sat Jul 30 08:23:47 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/7bc77374 (commit)
from https://github.com/Gnucash/gnucash/commit/accdf9e8 (commit)
commit 7bc7737476ffc5ba1e9a64751ae17285b76ddf9c
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Jul 30 16:21:03 2022 +0800
[gnc-dense-cal] further GList* and char* leaks
- mark->name and mark->info both leaked
- fixing poorly written for loop to g_list_free tags properly
diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 132b9f459..9b3390dc2 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -821,6 +821,7 @@ gdc_free_all_mark_data(GncDenseCal *dcal)
gdc_mark_data *mark = l->data;
g_list_free (mark->ourMarks);
g_free (mark->name);
+ g_free (mark->info);
g_free (mark);
}
g_list_free(dcal->markData);
@@ -1888,26 +1889,22 @@ cleanup:
static void
gdc_add_markings(GncDenseCal *cal)
{
- GList *tags;
- tags = gnc_dense_cal_model_get_contained(cal->model);
- for (; tags != NULL; tags = tags->next)
- {
- guint tag = GPOINTER_TO_UINT(tags->data);
- gdc_add_tag_markings(cal, tag);
- }
+ GList *tags = gnc_dense_cal_model_get_contained(cal->model);
+
+ for (GList *n = tags; n; n = n->next)
+ gdc_add_tag_markings(cal, GPOINTER_TO_UINT(n->data));
+
g_list_free(tags);
}
static void
gdc_remove_markings(GncDenseCal *cal)
{
- GList *tags;
- tags = gnc_dense_cal_model_get_contained(cal->model);
- for (; tags != NULL; tags = tags->next)
- {
- guint tag = GPOINTER_TO_UINT(tags->data);
- gdc_mark_remove(cal, tag, FALSE);
- }
+ GList *tags = gnc_dense_cal_model_get_contained(cal->model);
+
+ for (GList *n = tags; n; n = n->next)
+ gdc_mark_remove(cal, GPOINTER_TO_UINT(n->data), FALSE);
+
g_list_free(tags);
}
@@ -2051,6 +2048,8 @@ gdc_mark_remove(GncDenseCal *dcal, guint mark_to_remove, gboolean redraw)
}
g_list_free(mark_data->ourMarks);
dcal->markData = g_list_remove(dcal->markData, mark_data);
+ g_free (mark_data->name);
+ g_free (mark_data->info);
g_free(mark_data);
if (redraw)
Summary of changes:
gnucash/gnome-utils/gnc-dense-cal.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
More information about the gnucash-changes
mailing list