aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/dispatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/dispatch.c')
-rw-r--r--xorg-server/dix/dispatch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 17fa75e19..9208582a6 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -344,7 +344,7 @@ Dispatch(void)
nextFreeClientID = 1;
nClients = 0;
- clientReady = malloc(sizeof(int) * MaxClients);
+ clientReady = xallocarray(MaxClients, sizeof(int));
if (!clientReady)
return;
@@ -963,7 +963,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;
@@ -2786,7 +2786,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 =
@@ -2908,10 +2908,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);