mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
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:
@@ -1521,8 +1521,10 @@ get_mcast_options(int argc, char **argv, int i)
|
||||
else {
|
||||
struct multicastinfo *mcastinfo, *mcl;
|
||||
|
||||
mcastinfo = malloc(sizeof(struct multicastinfo));
|
||||
mcastinfo->next = NULL;
|
||||
mcastinfo = calloc(1, sizeof(struct multicastinfo));
|
||||
if (!mcastinfo)
|
||||
FatalError("Xserver: failed to allocate mcastinfo\n");
|
||||
|
||||
mcastinfo->ai = firstai;
|
||||
mcastinfo->hops = hopcount;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user