[cairo-commit] 2 commits - src/cairo-xlib-render-compositor.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jul 6 14:28:39 PDT 2015


 src/cairo-xlib-render-compositor.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit dced42a6801ea0f7ff9fa9f7aa3c7b2a10103884
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jul 6 22:26:14 2015 +0100

    xlib: Avoid using uninitialised variable on impossible error path
    
    In commit f6843d5cbb79c35f7b331ac31c4a55c9574928fc
    Author: Arpit Jain <jain.arpit at samsung.com>
    Date:   Mon Jul 6 14:13:06 2015 -0700
    
        xlib: Fix deferencing of uninitialised 'display'
    
    the common error + clenaup path was clumsily fixed to use the right
    variable after the error didn't set the local display variable.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
index 8a1ec7b..861ebe6 100644
--- a/src/cairo-xlib-render-compositor.c
+++ b/src/cairo-xlib-render-compositor.c
@@ -965,7 +965,7 @@ _cairo_xlib_font_fini (cairo_scaled_font_private_t *abstract_private,
     cairo_list_del (&priv->link);
 
     status = _cairo_xlib_display_acquire (priv->device, &display);
-    if (status)
+    if (unlikely (status)) /* this should be impossible but leak just in case */
 	goto BAIL;
 
     for (i = 0; i < NUM_GLYPHSETS; i++) {
@@ -978,7 +978,7 @@ _cairo_xlib_font_fini (cairo_scaled_font_private_t *abstract_private,
 
     cairo_device_release (&display->base);
 BAIL:
-    cairo_device_destroy (&display->base);
+    cairo_device_destroy (priv->device);
     free (priv);
 }
 
commit 84b8d7657615d3ecc11b029151dfd87704f15641
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jul 6 22:24:29 2015 +0100

    Revert "xlib: Fix deferencing of uninitialised 'display'"
    
    This reverts commit f6843d5cbb79c35f7b331ac31c4a55c9574928fc.

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


More information about the cairo-commit mailing list