summaryrefslogtreecommitdiffstats
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
parentf76b84a04b75e98eee56e8dc277564d0fbb99018 (diff)
downloadhqemu-b3c33f91732ea32e7a8391c5e61c3fc02308d822.zip
hqemu-b3c33f91732ea32e7a8391c5e61c3fc02308d822.tar.gz
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>
-rw-r--r--ui/vnc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index b514777..1e95445 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;
}
OpenPOWER on IntegriCloud