mirror of https://github.com/xemu-project/xemu.git
sockets: avoid crash when cleaning up sockets for an invalid FD
If socket_listen_cleanup is passed an invalid FD, then querying the socket local address will fail. We must thus be prepared for the returned addr to be NULL Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
5e19aed59a
commit
2d7ad7c05e
|
@ -1079,6 +1079,9 @@ void socket_listen_cleanup(int fd, Error **errp)
|
||||||
SocketAddress *addr;
|
SocketAddress *addr;
|
||||||
|
|
||||||
addr = socket_local_address(fd, errp);
|
addr = socket_local_address(fd, errp);
|
||||||
|
if (!addr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (addr->type == SOCKET_ADDRESS_TYPE_UNIX
|
if (addr->type == SOCKET_ADDRESS_TYPE_UNIX
|
||||||
&& addr->u.q_unix.path) {
|
&& addr->u.q_unix.path) {
|
||||||
|
|
Loading…
Reference in New Issue