Message ID | 20171027085633.14367-1-berrange@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
* Daniel P. Berrange (berrange@redhat.com) wrote: > 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> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > --- > util/qemu-sockets.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c > index b47fb45885..c7fdaa63fb 100644 > --- a/util/qemu-sockets.c > +++ b/util/qemu-sockets.c > @@ -1073,6 +1073,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) { > -- > 2.13.6 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index b47fb45885..c7fdaa63fb 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -1073,6 +1073,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) {
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> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- util/qemu-sockets.c | 3 +++ 1 file changed, 3 insertions(+)