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:
parent
c389f28af0
commit
fd3d162331
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue