mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-08 14:58:08 +02:00
Xi: handle allocation failure in ProcXListInputDevices()
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../Xi/listdev.c:171:5:
warning[-Wanalyzer-possible-null-dereference]:
dereference of possibly-NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xi/listdev.c:379:23:
acquire_memory: this call could return NULL
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 19c6195e71)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2076>
This commit is contained in:
parent
8891f18f69
commit
a44f3160e8
1 changed files with 4 additions and 0 deletions
|
|
@ -377,6 +377,10 @@ ProcXListInputDevices(ClientPtr client)
|
||||||
/* allocate space for reply */
|
/* allocate space for reply */
|
||||||
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
|
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
|
||||||
devbuf = (char *) calloc(1, total_length);
|
devbuf = (char *) calloc(1, total_length);
|
||||||
|
if (!devbuf) {
|
||||||
|
free(skip);
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
|
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
|
||||||
namebuf = classbuf + size;
|
namebuf = classbuf + size;
|
||||||
savbuf = devbuf;
|
savbuf = devbuf;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue