From: Gonglei <[email protected]> vs->lsock may equal to 0, modify the check condition, avoid possible vs->lsock leak.
Signed-off-by: Gonglei <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> --- ui/vnc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 1.8.3.1
