[xdg-desktop-portal-gnome/wip/rishi/coverity-fixes-00: 3/5] wallpaperdialog: Don't leak the temporary URI string




commit d6e0737f3b09b5c6cc93d419578838435bcf4197
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 30 18:03:51 2022 +0200

    wallpaperdialog: Don't leak the temporary URI string
    
    There's no need to duplicate the temporary URI string because
    g_file_get_uri already returns a new copy for the caller to own.
    
    https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/42

 src/wallpaperdialog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/wallpaperdialog.c b/src/wallpaperdialog.c
index 999e121..cd34b9c 100644
--- a/src/wallpaperdialog.c
+++ b/src/wallpaperdialog.c
@@ -135,7 +135,7 @@ on_image_loaded_cb (GObject *source_object,
 
   g_file_replace_contents (tmp, contents, length, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, 
NULL, &error);
 
-  self->picture_uri = g_strdup (g_file_get_uri (tmp));
+  self->picture_uri = g_file_get_uri (tmp);
   wallpaper_preview_set_image (self->desktop_preview,
                                self->picture_uri);
 }


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