From 6fd19f2eeaaf2fce26da3c0375d358c1b5364a93 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Fri, 13 Aug 2021 08:51:14 +0800 Subject: [PATCH] [dialog-lot-viewer] g_free a GList* properly g_list_free requires the argument is the head of a GList. Calling g_list_reverse makes the filtered_list points to the last element. Assigning filtered_list to the result of g_list_reverse ensures it still points to the head, allowing g_list_free to free the list properly. --- gnucash/gnome/dialog-lot-viewer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnucash/gnome/dialog-lot-viewer.c b/gnucash/gnome/dialog-lot-viewer.c index 8413b9c1f3..7bd5ebcd05 100644 --- a/gnucash/gnome/dialog-lot-viewer.c +++ b/gnucash/gnome/dialog-lot-viewer.c @@ -231,9 +231,10 @@ lv_show_splits_free (GNCLotViewer *lv) filtered_list = g_list_prepend (filtered_list, split); } } + filtered_list = g_list_reverse (filtered_list); /* display list */ - gnc_split_viewer_fill(lv, lv->split_free_store, g_list_reverse (filtered_list)); + gnc_split_viewer_fill(lv, lv->split_free_store, filtered_list); g_list_free (filtered_list); }