[cairo-commit] src/cairo-boxes.c

Andrea Canciani ranma42 at kemper.freedesktop.org
Wed Apr 7 13:59:43 PDT 2010


 src/cairo-boxes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 70ca0040fda77b6865c20c94c1b7deaa6e63c481
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Apr 7 22:54:57 2010 +0200

    Actually check for memory allocation failure
    
    Clang static analyzer signals "Dereference of null pointer" in case
    the malloc returns NULL, as the code is checking the wrong pointer.

diff --git a/src/cairo-boxes.c b/src/cairo-boxes.c
index d2b9e7e..363f8e7 100644
--- a/src/cairo-boxes.c
+++ b/src/cairo-boxes.c
@@ -128,7 +128,7 @@ _cairo_boxes_add_internal (cairo_boxes_t *boxes,
 					       sizeof (cairo_box_t),
 					       sizeof (struct _cairo_boxes_chunk));
 
-	if (unlikely (chunk == NULL)) {
+	if (unlikely (chunk->next == NULL)) {
 	    boxes->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 	    return;
 	}


More information about the cairo-commit mailing list