xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Mar 8 20:37:59 UTC 2021
mi/miexpose.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit b2d96b5cd459963a9587ee9c86afc9266ba3d02b
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date: Sat Feb 27 11:30:18 2021 +0100
Avoid sequences of malloc(0) / free() by checking the length.
This has an impact on heap fragmentation.
Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/mi/miexpose.c b/mi/miexpose.c
index d84bb6a98..e54b18b30 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -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;
More information about the xorg-commit
mailing list