diff options
Diffstat (limited to 'xorg-server/dix/dispatch.c')
-rwxr-xr-x | xorg-server/dix/dispatch.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index 45bd238ff..4a003b5bc 100755 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -348,7 +348,7 @@ Dispatch(void) nextFreeClientID = 1;
nClients = 0;
- clientReady = malloc(sizeof(int) * MaxClients);
+ clientReady = xallocarray(MaxClients, sizeof(int));
if (!clientReady)
return;
@@ -1008,7 +1008,7 @@ ProcQueryTree(ClientPtr client) if (numChildren) {
int curChild = 0;
- childIDs = malloc(numChildren * sizeof(Window));
+ childIDs = xallocarray(numChildren, sizeof(Window));
if (!childIDs)
return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead;
@@ -2830,7 +2830,7 @@ ProcQueryColors(ClientPtr client) count =
bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
- prgbs = calloc(1, count * sizeof(xrgb));
+ prgbs = calloc(count, sizeof(xrgb));
if (!prgbs && count)
return BadAlloc;
if ((rc =
@@ -2952,10 +2952,10 @@ ProcCreateCursor(ClientPtr client) if (stuff->x > width || stuff->y > height)
return BadMatch;
- n = BitmapBytePad(width) * height;
- srcbits = calloc(1, n);
+ srcbits = calloc(BitmapBytePad(width), height);
if (!srcbits)
return BadAlloc;
+ n = BitmapBytePad(width) * height;
mskbits = malloc(n);
if (!mskbits) {
free(srcbits);
|