summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserwidget.c
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2023-03-08 00:28:25 +0100
committerBarnabás Pőcze <pobrn@protonmail.com>2023-03-08 03:59:10 +0100
commitf0e4293b8392c9d95ba3f98efb117b5ca411325c (patch)
treedc2081ede37a0f6a9c236b3c82504e3103c032c0 /gtk/gtkfilechooserwidget.c
parent30586d75acae8ab45ffd4ad58a1855ea5c58ac8a (diff)
downloadgtk+-f0e4293b8392c9d95ba3f98efb117b5ca411325c.tar.gz
filechooser: Fix memory leaks
The returned strings from `file_chooser_get_location()` were never freed.
Diffstat (limited to 'gtk/gtkfilechooserwidget.c')
-rw-r--r--gtk/gtkfilechooserwidget.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 9f084a6e77..2ab5050fd4 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -6989,15 +6989,20 @@ location_sort_func (gconstpointer a,
gpointer user_data)
{
GtkFileChooserWidget *impl = user_data;
+ char *location_a, *location_b;
char *key_a, *key_b;
GtkOrdering result;
/* FIXME: use sortkeys for these */
- key_a = g_utf8_collate_key_for_filename (file_chooser_get_location (impl, (GFileInfo *)a), -1);
- key_b = g_utf8_collate_key_for_filename (file_chooser_get_location (impl, (GFileInfo *)b), -1);
+ location_a = file_chooser_get_location (impl, (GFileInfo *)a);
+ location_b = file_chooser_get_location (impl, (GFileInfo *)b);
+ key_a = g_utf8_collate_key_for_filename (location_a, -1);
+ key_b = g_utf8_collate_key_for_filename (location_b, -1);
result = g_strcmp0 (key_a, key_b);
+ g_free (location_a);
+ g_free (location_b);
g_free (key_a);
g_free (key_b);