[glib/glib-2-72: 3/39] documentportal: Fix small leak in add_documents with empty URI list




commit aafa45e583d8998853ca97f35f89f34ddbfaca56
Author: Sebastian Keller <skeller gnome org>
Date:   Tue Aug 30 21:39:36 2022 +0200

    documentportal: Fix small leak in add_documents with empty URI list
    
    When called with an empty URI list (or only inaccessible files),
    g_document_portal_add_documents would not call g_variant_builder_end,
    leaking the memory allocated by the variant builder.
    
    Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/2733
    
    (cherry-picked from commit 27203e48c91ab8b55033dcf1773cb60c0aaed3fa)

 gio/gdocumentportal.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gio/gdocumentportal.c b/gio/gdocumentportal.c
index 644829a716..276a1dce66 100644
--- a/gio/gdocumentportal.c
+++ b/gio/gdocumentportal.c
@@ -201,6 +201,7 @@ g_document_portal_add_documents (GList       *uris,
   else
     {
       ruris = g_list_copy_deep (uris, (GCopyFunc)g_strdup, NULL);
+      g_variant_builder_clear (&builder);
     }
 
 out:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]