aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-sockets.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2017-10-27 08:51:59 +0100
committerDaniel P. Berrange <berrange@redhat.com>2017-11-28 10:48:04 +0000
commit2d7ad7c05e762d5b10a57eba9af1bb6b41700854 (patch)
tree89d6cd38e4b59739e7851de3033399348f0b6448 /util/qemu-sockets.c
parent5e19aed59ab48ca3c7f1e2da203eed27b91bef2d (diff)
downloadqemu-2d7ad7c05e762d5b10a57eba9af1bb6b41700854.zip
qemu-2d7ad7c05e762d5b10a57eba9af1bb6b41700854.tar.gz
qemu-2d7ad7c05e762d5b10a57eba9af1bb6b41700854.tar.bz2
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>
Diffstat (limited to 'util/qemu-sockets.c')
-rw-r--r--util/qemu-sockets.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 8b75541..a1cf47e 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1079,6 +1079,9 @@ void socket_listen_cleanup(int fd, Error **errp)
SocketAddress *addr;
addr = socket_local_address(fd, errp);
+ if (!addr) {
+ return;
+ }
if (addr->type == SOCKET_ADDRESS_TYPE_UNIX
&& addr->u.q_unix.path) {