(!1601) Xext: xres: ProcXResQueryClientResources(): put temporary int array on stack

Simplify allocaton by putting the small temporary int array onto stack.
This also allows further simplifications by upcoming commits.

The upper bound is determined by the number of resource types registered
in the server - this can only be increased by writing new extensions.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-17 13:06:54 +02:00
parent 6d59cd5a22
commit 6bf2dea53f

View File

@ -294,7 +294,6 @@ ProcXResQueryClientResources(ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
int i, clientID, num_types = 0;
int *counts;
clientID = CLIENT_ID(stuff->xid);
@ -303,7 +302,8 @@ ProcXResQueryClientResources(ClientPtr client)
return BadValue;
}
counts = calloc(lastResourceType + 1, sizeof(int));
int counts[lastResourceType + 1];
memset(counts, 0, sizeof(counts));
FindAllClientResources(clients[clientID], ResFindAllRes, counts);
@ -344,8 +344,6 @@ ProcXResQueryClientResources(ClientPtr client)
}
}
free(counts);
return Success;
}