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




commit 639ef5a754dd58f6ee9583d6813cc54a4e26ae60
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]