Xi: add NULL checks to handle malloc failures

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
This commit is contained in:
Peter Hutterer 2026-04-17 10:29:33 +10:00 committed by Marge Bot
parent 532987415e
commit 3c5f5f4cf1
2 changed files with 5 additions and 0 deletions

View file

@ -1057,6 +1057,9 @@ TouchSendOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, int reason,
int nev, i;
InternalEvent *tel = InitEventList(GetMaximumEventsNum());
if (!tel)
return;
nev = GetTouchOwnershipEvents(tel, dev, ti, reason, resource, 0);
for (i = 0; i < nev; i++)
mieqProcessDeviceEvent(dev, tel + i, NULL);

View file

@ -132,6 +132,8 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
sizeof(XEventClass);
rep.length = bytes_to_int32(total_length);
buf = (XEventClass *) malloc(total_length);
if (!buf)
return BadAlloc;
tclient = buf;
aclient = buf + rep.this_client_count;