Commit b2d96b5c authored by Matthieu Herrb's avatar Matthieu Herrb Committed by Peter Hutterer
Browse files

Avoid sequences of malloc(0) / free() by checking the length.



This has an impact on heap fragmentation.
Signed-off-by: default avatarMatthieu Herrb <matthieu.herrb@laas.fr>
parent 15a413e1
Pipeline #280935 passed with stages
in 4 minutes and 56 seconds
......@@ -404,7 +404,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
int i;
BoxPtr pbox;
xRectangle *prect;
int numRects;
int numRects, regionnumrects;
/*
* Distance from screen to destination drawable, use this
......@@ -508,7 +508,10 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
}
prect = xallocarray(RegionNumRects(prgn), sizeof(xRectangle));
regionnumrects = RegionNumRects(prgn);
if (regionnumrects == 0)
return;
prect = xallocarray(regionnumrects, sizeof(xRectangle));
if (!prect)
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment