filechoosernative: Plug a memory leak
authorMatthias Clasen <mclasen@redhat.com>
Thu, 27 Apr 2023 06:25:30 +0000 (08:25 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 27 Apr 2023 11:42:03 +0000 (13:42 +0200)
Unref all the GVariants.

gtk/gtkfilechoosernativeportal.c

index 254e62fd952841ca60edd79a66a42248003453e1..3d73fa6db9f76c15f8ba936bd385a8f18eca4e6d 100644 (file)
@@ -164,6 +164,8 @@ response_cb (GDBusConnection  *connection,
       g_object_unref (filters);
       gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (self), filter_to_select);
       g_object_unref (filter_to_select);
+
+      g_variant_unref (current_filter);
     }
 
   g_slist_free_full (self->custom_files, g_object_unref);
@@ -171,6 +173,9 @@ response_cb (GDBusConnection  *connection,
   for (i = 0; uris[i]; i++)
     self->custom_files = g_slist_prepend (self->custom_files, g_file_new_for_uri (uris[i]));
 
+  g_free (uris);
+  g_variant_unref (response_data);
+
   switch (portal_response)
     {
     case 0: