[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] sockets: avoid leak of listen file descriptor
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [PATCH] sockets: avoid leak of listen file descriptor |
Date: |
Fri, 20 Oct 2017 10:54:31 +0100 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Fri, Oct 20, 2017 at 10:28:44AM +0100, Daniel P. Berrange wrote:
> If we iterate over the full port range without successfully binding+listening
> on the socket, we'll try the next address, whereupon we overwrite the slisten
> file descriptor variable without closing it.
>
> Rather than having two places where we open + close socket FDs on different
> iterations of nested for loops, re-arrange the code to always open+close
> within the same loop iteration.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> util/qemu-sockets.c | 31 +++++++++++++++++++------------
> 1 file changed, 19 insertions(+), 12 deletions(-)
Self-NACK this has a bug too
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|