From: Gonglei Date: Wed, 11 Mar 2015 08:21:01 +0000 (+0800) Subject: vnc: avoid possible file handler leak X-Git-Tag: v2.3.0-rc0~20^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3c33f91732ea32e7a8391c5e61c3fc02308d822;p=thirdparty%2Fqemu.git vnc: avoid possible file handler leak vs->lsock may equal to 0, modify the check condition, avoid possible vs->lsock leak. Signed-off-by: Gonglei Signed-off-by: Gerd Hoffmann --- diff --git a/ui/vnc.c b/ui/vnc.c index b514777c6ea..1e95445c4a2 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3644,7 +3644,7 @@ void vnc_display_open(const char *id, Error **errp) if (vs->ws_enabled) { vs->lwebsock = inet_listen_opts(wsopts, 0, errp); if (vs->lwebsock < 0) { - if (vs->lsock) { + if (vs->lsock != -1) { close(vs->lsock); vs->lsock = -1; }