[gdk-pixbuf] io: Only ref pixbuf if it is not NULL



commit 33bc1455b2f59434d24603b2d4b6525a6e43c19c
Author: Benjamin Otte <otte redhat com>
Date:   Mon Nov 20 03:02:03 2017 +0100

    io: Only ref pixbuf if it is not NULL

 gdk-pixbuf/gdk-pixbuf-io.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 4143a97..c8dee4d 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -1866,6 +1866,7 @@ gdk_pixbuf_new_from_stream_finish (GAsyncResult  *async_result,
                                   GError       **error)
 {
        GTask *task;
+        GdkPixbuf *result;
 
        g_return_val_if_fail (g_task_is_valid (async_result, NULL), NULL);
        g_return_val_if_fail (!error || (error && !*error), NULL);
@@ -1875,7 +1876,10 @@ gdk_pixbuf_new_from_stream_finish (GAsyncResult  *async_result,
        g_warn_if_fail (g_task_get_source_tag (task) == gdk_pixbuf_new_from_stream_async ||
                        g_task_get_source_tag (task) == gdk_pixbuf_new_from_stream_at_scale_async);
 
-       return g_object_ref (g_task_propagate_pointer (task, error));
+       result = g_task_propagate_pointer (task, error);
+        if (result)
+          g_object_ref (result);
+        return result;
 }
 
 static void


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