mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 05:50:04 +01: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>
This commit is contained in:
parent
5e62aaaf57
commit
3da60c96a9
1 changed files with 2 additions and 0 deletions
|
|
@ -224,6 +224,8 @@ ProcXResQueryClients(ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
||||||
|
|
||||||
current_clients = xallocarray(currentMaxClients, sizeof(int));
|
current_clients = xallocarray(currentMaxClients, sizeof(int));
|
||||||
|
if (current_clients == NULL)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
num_clients = 0;
|
num_clients = 0;
|
||||||
for (i = 0; i < currentMaxClients; i++) {
|
for (i = 0; i < currentMaxClients; i++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue