aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2015-03-11 16:21:01 +0800
committerGerd Hoffmann <kraxel@redhat.com>2015-03-12 08:22:12 +0100
commitb3c33f91732ea32e7a8391c5e61c3fc02308d822 (patch)
tree233dff1c089c8b26294a3385d4911f5bcd494aa9 /ui/vnc.c
parentf76b84a04b75e98eee56e8dc277564d0fbb99018 (diff)
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 <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c2
1 files changed, 1 insertions, 1 deletions
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;
}