[gdk-pixbuf] gdk-pixbuf: Add NULL guards to some utility functions



commit afb4f77c1e11a392dd310a2689e130c46dceb69e
Author: Sarita Rawat <sarita rawat samsung com>
Date:   Fri Sep 11 12:02:00 2015 +0000

    gdk-pixbuf: Add NULL guards to some utility functions
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754878

 gdk-pixbuf/gdk-pixbuf-scale.c |    2 ++
 gdk-pixbuf/gdk-pixbuf-util.c  |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-scale.c b/gdk-pixbuf/gdk-pixbuf-scale.c
index 475126a..945e3a4 100644
--- a/gdk-pixbuf/gdk-pixbuf-scale.c
+++ b/gdk-pixbuf/gdk-pixbuf-scale.c
@@ -422,6 +422,7 @@ gdk_pixbuf_rotate_simple (const GdkPixbuf   *src,
   guchar *q;
   gint x, y;
 
+  g_return_val_if_fail (GDK_IS_PIXBUF (src), NULL);
   src_pixels = gdk_pixbuf_read_pixels (src);
 
   switch (angle % 360)
@@ -526,6 +527,7 @@ gdk_pixbuf_flip (const GdkPixbuf *src,
   guchar *q;
   gint x, y;
 
+  g_return_val_if_fail (GDK_IS_PIXBUF (src), NULL);
   dest = gdk_pixbuf_new (src->colorspace, 
                         src->has_alpha, 
                         src->bits_per_sample, 
diff --git a/gdk-pixbuf/gdk-pixbuf-util.c b/gdk-pixbuf/gdk-pixbuf-util.c
index 3600450..db1562b 100644
--- a/gdk-pixbuf/gdk-pixbuf-util.c
+++ b/gdk-pixbuf/gdk-pixbuf-util.c
@@ -282,7 +282,8 @@ gdk_pixbuf_saturate_and_pixelate(const GdkPixbuf *src,
  * appropriate transform will be performed so that the pixbuf
  * is oriented correctly.
  *
- * Return value: (transfer full): A newly-created pixbuf, or a reference to the
+ * Return value: (transfer full): A newly-created pixbuf, %NULL if
+ * not enough memory could be allocated for it, or a reference to the
  * input pixbuf (with an increased reference count).
  *
  * Since: 2.12


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