From f5754adb681d55e985147b56de9c2b30c8cbc9f1 Mon Sep 17 00:00:00 2001 From: Dmitrii Naidolinskii Date: Sun, 28 Aug 2022 16:37:54 +0500 Subject: [PATCH] shell: Fix pixbuf reference leak saving screenshots When saving a screenshot, the GdkPixbuf created would be left with a dangling reference after saving to disk (either leaked on errors, or via an extra reference on success). Always unref the pixbuf so it's either destroyed on error or there is a single reference fully transferred to the caller of the function. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5501 Part-of: --- src/shell-screenshot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c index fcf2da236..c173dd5d8 100644 --- a/src/shell-screenshot.c +++ b/src/shell-screenshot.c @@ -1061,6 +1061,7 @@ composite_to_stream_on_png_saved (GObject *pixbuf, else g_task_return_pointer (task, g_object_ref (pixbuf), g_object_unref); + g_object_unref (pixbuf); g_object_unref (task); }