From 5ec27eef9566faa22fb1cbaf1a103a57ba5296c8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 3 May 2007 13:46:25 +0100 Subject: [PATCH] [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. --- pixman/src/pixregion.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pixman/src/pixregion.c b/pixman/src/pixregion.c index dfb1f2458..9df6611cf 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.