[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.
This commit is contained in:
Chris Wilson 2007-05-03 13:46:25 +01:00
parent ef30708217
commit 5ec27eef95

View file

@ -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.