We can not rely on the value of func after
_pixman_implementation_lookup_composite() as the sole means of
identifying a bogus implementation as it is left uninitialized on the
error path. Instead we need to check the explicit return value.

Reported-by: Juan Francisco Cantero Hurtado <i...@juanfra.info>
Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 pixman/pixman-glyph.c |   30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/pixman/pixman-glyph.c b/pixman/pixman-glyph.c
index 6d2c8bb..5451f42 100644
--- a/pixman/pixman-glyph.c
+++ b/pixman/pixman-glyph.c
@@ -463,15 +463,13 @@ pixman_composite_glyphs_no_mask (pixman_op_t            
op,
                {
                    glyph_format = glyph_img->common.extended_format_code;
                    glyph_flags = glyph_img->common.flags;
-                   
-                   _pixman_implementation_lookup_composite (
-                       get_implementation(), op,
-                       src->common.extended_format_code, src->common.flags,
-                       glyph_format, glyph_flags | extra,
-                       dest_format, dest_flags,
-                       &implementation, &func);
-
-                   if (!func)
+
+                   if (! _pixman_implementation_lookup_composite (
+                           get_implementation(), op,
+                           src->common.extended_format_code, src->common.flags,
+                           glyph_format, glyph_flags | extra,
+                           dest_format, dest_flags,
+                           &implementation, &func))
                        goto out;
                }
 
@@ -576,14 +574,12 @@ add_glyphs (pixman_glyph_cache_t *cache,
                white_src = TRUE;
            }
 
-           _pixman_implementation_lookup_composite (
-               get_implementation(), PIXMAN_OP_ADD,
-               src_format, info.src_flags,
-               mask_format, info.mask_flags,
-               dest_format, dest_flags,
-               &implementation, &func);
-
-           if (!func)
+           if (! _pixman_implementation_lookup_composite (
+                   get_implementation(), PIXMAN_OP_ADD,
+                   src_format, info.src_flags,
+                   mask_format, info.mask_flags,
+                   dest_format, dest_flags,
+                   &implementation, &func))
                goto out;
        }
 
-- 
1.7.10.4

_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to