Let calloc handle multiplication

It's going to multiply anyway, so if we have non-constant values, might
as well let it do the multiplication instead of adding another multiply,
and good versions of calloc will check for & avoid overflow in the process.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Alan Coopersmith
2015-03-21 11:07:24 -07:00
parent a28202a148
commit f3ba909753
7 changed files with 11 additions and 13 deletions

View File

@@ -1106,7 +1106,7 @@ PanoramiXCopyArea(ClientPtr client)
}
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
if (!(data = calloc(1, stuff->height * pitch)))
if (!(data = calloc(stuff->height, pitch)))
return BadAlloc;
XineramaGetImageData(drawables, srcx, srcy,