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>
This commit is contained in:
Gonglei 2015-03-11 16:21:01 +08:00 committed by Gerd Hoffmann
parent f76b84a04b
commit b3c33f9173

View File

@ -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;
}