[gdk-pixbuf] gdk-pixbuf-loader: Add a missing NULL check



commit 2634506c2f3897fc83dd3049210fffa5edccf3eb
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Jan 7 17:13:30 2017 +0000

    gdk-pixbuf-loader: Add a missing NULL check
    
    The code just above checks whether image_module is NULL, and it doesn’t
    look like it can change in the meantime, so we should also check before
    dereferencing it for load_increment.
    
    Make this an assertion; although we’re not entirely sure how this code
    was originally supposed to work, we’re still in development, so we can
    investigate any assertion failures with impunity.
    
    Coverity CID: 1388529
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776990

 gdk-pixbuf/gdk-pixbuf-loader.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
index f6d5878..9f0fa79 100644
--- a/gdk-pixbuf/gdk-pixbuf-loader.c
+++ b/gdk-pixbuf/gdk-pixbuf-loader.c
@@ -516,7 +516,10 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
                         buf += eaten;
                 }
   
-        if (count > 0 && priv->image_module->load_increment)
+        /* By this point, we expect the image_module to have been loaded. */
+        g_assert (priv->image_module != NULL);
+
+        if (count > 0 && priv->image_module->load_increment != NULL)
                 {
                         if (!priv->image_module->load_increment (priv->context, buf, count,
                                                                  error))


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