[cairo] [PATCH] xlib: Fix deferencing of uninitialised 'display'

Arpit Jain jain.arpit at samsung.com
Tue Jun 30 02:53:29 PDT 2015


    Initialising 'display' to NULL and checking before deferencing during display->base.
    This patch will check the deferencing of uninitialised 'display' in case,
    _cairo_xlib_display_acquire does not return CAIRO_STATUS_SUCCESS.

    Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=87893

Signed-off-by: Arpit Jain <jain.arpit at samsung.com>
---
 src/cairo-xlib-render-compositor.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
index 8a1ec7b..055780d 100644
--- a/src/cairo-xlib-render-compositor.c
+++ b/src/cairo-xlib-render-compositor.c
@@ -958,7 +958,7 @@ _cairo_xlib_font_fini (cairo_scaled_font_private_t *abstract_private,
 {
     cairo_xlib_font_t *priv = (cairo_xlib_font_t *) abstract_private;
     cairo_status_t status;
-    cairo_xlib_display_t *display;
+    cairo_xlib_display_t *display = NULL;
     int i;
 
     cairo_list_del (&priv->base.link);
@@ -978,7 +978,11 @@ _cairo_xlib_font_fini (cairo_scaled_font_private_t *abstract_private,
 
     cairo_device_release (&display->base);
 BAIL:
-    cairo_device_destroy (&display->base);
+    if(display)
+	cairo_device_destroy (&display->base);
+    else
+	cairo_device_destroy (priv->device);
+	
     free (priv);
 }
 
-- 
1.7.9.5




More information about the cairo mailing list