Xi: ProcXGetSelectedExtensionEvents(): protect from allocation failure

If allocation fails, bail out with BadAlloc, instead of segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-16 05:42:58 +02:00
committed by Enrico Weigelt
parent 036cbb4ff2
commit 0680117493

View File

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