summaryrefslogtreecommitdiff
path: root/xserver/dix/dispatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/dix/dispatch.c')
-rw-r--r--xserver/dix/dispatch.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/xserver/dix/dispatch.c b/xserver/dix/dispatch.c
index 17fa75e19..2c201245a 100644
--- a/xserver/dix/dispatch.c
+++ b/xserver/dix/dispatch.c
@@ -108,6 +108,7 @@ int ProcInitialConnection();
#include "windowstr.h"
#include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fontutil.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "selection.h"
@@ -344,7 +345,7 @@ Dispatch(void)
nextFreeClientID = 1;
nClients = 0;
- clientReady = malloc(sizeof(int) * MaxClients);
+ clientReady = xallocarray(MaxClients, sizeof(int));
if (!clientReady)
return;
@@ -963,7 +964,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 +2787,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 +2909,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);
@@ -3483,7 +3484,7 @@ NextAvailableClient(void *ospriv)
xReq data;
i = nextFreeClientID;
- if (i == MAXCLIENTS)
+ if (i == LimitClients)
return (ClientPtr) NULL;
clients[i] = client =
dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
@@ -3503,7 +3504,7 @@ NextAvailableClient(void *ospriv)
}
if (i == currentMaxClients)
currentMaxClients++;
- while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID])
+ while ((nextFreeClientID < LimitClients) && clients[nextFreeClientID])
nextFreeClientID++;
/* Enable client ID tracking. This must be done before