Avoid segfault in CloseWellKnownConnections when using -displayfd
When -displayfd is looping through the possible display ids to use,
if it can't open all the listening sockets for one (say when :0 is
already in use), it calls CloseWellKnownConnections to close all
the ListenTransConns entries before the point that ListenTransFds
was allocated & initialized, so CloseWellKnownConnections would
segfault trying to read entries from a NULL ListenTransFds pointer.
Introduced by commit 7b02f0b8
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
edcb6426f2
commit
ba71b69f94
|
@ -523,6 +523,7 @@ CloseWellKnownConnections(void)
|
||||||
if (ListenTransConns[i] != NULL) {
|
if (ListenTransConns[i] != NULL) {
|
||||||
_XSERVTransClose(ListenTransConns[i]);
|
_XSERVTransClose(ListenTransConns[i]);
|
||||||
ListenTransConns[i] = NULL;
|
ListenTransConns[i] = NULL;
|
||||||
|
if (ListenTransFds != NULL)
|
||||||
RemoveNotifyFd(ListenTransFds[i]);
|
RemoveNotifyFd(ListenTransFds[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue