[cairo-commit] pixman/src

Chris Wilson ickle at kemper.freedesktop.org
Thu May 3 05:46:27 PDT 2007


 pixman/src/pixregion.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

New commits:
diff-tree 5ec27eef9566faa22fb1cbaf1a103a57ba5296c8 (from ef3070821713c33fab78abb191e27a62e165f6c6)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 3 13:46:25 2007 +0100

    [pixman] Free the old rects if we fail to allocate new.
    
    During the pixman_op, a complicated dance is performed to handle
    enlarging the rectangle array to accommodate the op. One consequence
    of this is to, under certain circumstances, replace the current
    rectangle array with emptyData and track the old array with oldData.
    Hence if we fail to realloc the enlarged array we need to free oldData.

diff --git a/pixman/src/pixregion.c b/pixman/src/pixregion.c
index dfb1f24..9df6611 100644
--- a/pixman/src/pixregion.c
+++ b/pixman/src/pixregion.c
@@ -670,9 +670,13 @@ pixman_op(
 	newReg->data = &pixman_region_emptyData;
     else if (newReg->data->size)
 	newReg->data->numRects = 0;
-    if (newSize > newReg->data->size)
-	if (!pixman_rect_alloc(newReg, newSize))
+    if (newSize > newReg->data->size) {
+	if (!pixman_rect_alloc(newReg, newSize)) {
+	    if (oldData)
+		free (oldData);
 	    return PIXMAN_REGION_STATUS_FAILURE;
+	}
+    }
 
     /*
      * Initialize ybot.


More information about the cairo-commit mailing list