mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Xext/xres: avoid null dereference in ProcXResQueryClients()
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../Xext/xres.c:233:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘current_clients’
xwayland-24.1.6/redhat-linux-build/../Xext/xres.c:228:23: acquire_memory: this call could return NULL
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
(cherry picked from commit 3da60c96a9)
This commit is contained in:
@@ -224,6 +224,8 @@ ProcXResQueryClients(ClientPtr client)
|
||||
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
||||
|
||||
current_clients = xallocarray(currentMaxClients, sizeof(int));
|
||||
if (current_clients == NULL)
|
||||
return BadAlloc;
|
||||
|
||||
num_clients = 0;
|
||||
for (i = 0; i < currentMaxClients; i++) {
|
||||
|
||||
Reference in New Issue
Block a user