From 7b18313e2a9d0409ac7465d2f313153013fdf5a3 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 5 Oct 2025 17:32:45 -0700 Subject: [PATCH] Xi: handle allocation failure in ProcXGetDeviceDontPropagateList() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported in #1817: xwayland-24.1.6/redhat-linux-build/../Xi/getprop.c:163:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘buf’ xwayland-24.1.6/redhat-linux-build/../Xi/getprop.c:121:19: acquire_memory: this call could return NULL Signed-off-by: Alan Coopersmith Part-of: --- Xi/getprop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Xi/getprop.c b/Xi/getprop.c index 54b8131ec..028888b20 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -118,6 +118,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client) if (count) { rep.count = count; buf = xallocarray(rep.count, sizeof(XEventClass)); + if (buf == NULL) + return BadAlloc; rep.length = bytes_to_int32(rep.count * sizeof(XEventClass)); tbuf = buf;