[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.
This commit is contained in:
Christopher Lam 2021-08-13 08:51:14 +08:00
parent 5ced0d932a
commit 6fd19f2eea

View File

@ -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);
}