os: xdmcp: handle allocation failure

| ../os/xdmcp.c: In function ‘get_mcast_options’:
| ../os/xdmcp.c:1527:27: warning: dereference of possibly-NULL ‘mcastinfo’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|  1527 |             mcastinfo->ai = firstai;
|       |             ~~~~~~~~~~~~~~^~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-06 16:14:05 +02:00
parent c389f28af0
commit fd3d162331

View File

@ -1521,8 +1521,10 @@ get_mcast_options(int argc, char **argv, int i)
else { else {
struct multicastinfo *mcastinfo, *mcl; struct multicastinfo *mcastinfo, *mcl;
mcastinfo = malloc(sizeof(struct multicastinfo)); mcastinfo = calloc(1, sizeof(struct multicastinfo));
mcastinfo->next = NULL; if (!mcastinfo)
FatalError("Xserver: failed to allocate mcastinfo\n");
mcastinfo->ai = firstai; mcastinfo->ai = firstai;
mcastinfo->hops = hopcount; mcastinfo->hops = hopcount;