From b3c33f91732ea32e7a8391c5e61c3fc02308d822 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Wed, 11 Mar 2015 16:21:01 +0800 Subject: [PATCH] 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 --- ui/vnc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/vnc.c b/ui/vnc.c index b514777c6e..1e95445c4a 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; }