xcmisc: ProcXCMiscGetXIDList(): declare variables where used first

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-16 04:51:45 +02:00
committed by Enrico Weigelt
parent f8fd9f7287
commit f50b238fe1

View File

@@ -94,20 +94,17 @@ static int
ProcXCMiscGetXIDList(ClientPtr client)
{
REQUEST(xXCMiscGetXIDListReq);
xXCMiscGetXIDListReply rep;
XID *pids;
unsigned int count;
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
pids = calloc(stuff->count, sizeof(XID));
XID *pids = calloc(stuff->count, sizeof(XID));
if (!pids) {
return BadAlloc;
}
count = GetXIDList(client, stuff->count, pids);
size_t count = GetXIDList(client, stuff->count, pids);
struct x_rpcbuf rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
@@ -117,7 +114,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
if (rpcbuf.error)
return BadAlloc;
rep = (xXCMiscGetXIDListReply) {
xXCMiscGetXIDListReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = count,