aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xnest/GC.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xnest/GC.c')
-rw-r--r--xorg-server/hw/xnest/GC.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/xorg-server/hw/xnest/GC.c b/xorg-server/hw/xnest/GC.c
index 96af6eb91..ecfa61e39 100644
--- a/xorg-server/hw/xnest/GC.c
+++ b/xorg-server/hw/xnest/GC.c
@@ -190,7 +190,7 @@ xnestDestroyGC(GCPtr pGC)
void
xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
{
- int i, size;
+ int i;
BoxPtr pBox;
XRectangle *pRects;
@@ -204,8 +204,7 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
case CT_REGION:
nRects = RegionNumRects((RegionPtr) pValue);
- size = nRects * sizeof(*pRects);
- pRects = (XRectangle *) malloc(size);
+ pRects = xallocarray(nRects, sizeof(*pRects));
pBox = RegionRects((RegionPtr) pValue);
for (i = nRects; i-- > 0;) {
pRects[i].x = pBox[i].x1;