From f50b238fe1374bca02e1249b31953c3029c31bd9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 16 Jul 2025 04:51:45 +0200 Subject: [PATCH] xcmisc: ProcXCMiscGetXIDList(): declare variables where used first Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/xcmisc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c index 9eb2850df0..c2ec2ba09f 100644 --- a/Xext/xcmisc.c +++ b/Xext/xcmisc.c @@ -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,