From f523ddfa3acf80016ea261c5e94fe16c312f0d8a Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 29 Mar 2026 16:07:20 -0700 Subject: [PATCH] os: handle memory allocation failure in get_mcast_options() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since this is in initial startup, and other errors in this function are already fatal, just make allocation failure of this small structure be fatal as well, since if the X server is already out of memory it will be dying soon anyway. Reported in #1817: xwayland-24.1.6/redhat-linux-build/../os/xdmcp.c:1514:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘mcastinfo’ xwayland-24.1.6/redhat-linux-build/../os/xdmcp.c:1513:25: acquire_memory: this call could return NULL xwayland-24.1.6/redhat-linux-build/../os/xdmcp.c:1514:13: danger: ‘mcastinfo’ could be NULL: unchecked value from (9) Signed-off-by: Alan Coopersmith --- os/xdmcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/xdmcp.c b/os/xdmcp.c index ce14a7069..83c8af62c 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -1518,7 +1518,7 @@ get_mcast_options(int argc, char **argv, int i) else { struct multicastinfo *mcastinfo, *mcl; - mcastinfo = malloc(sizeof(struct multicastinfo)); + mcastinfo = XNFalloc(sizeof(struct multicastinfo)); mcastinfo->next = NULL; mcastinfo->ai = firstai; mcastinfo->hops = hopcount;