From 5f8679fe46d78acfa5fc43a3fd6b3fe95525d9bd Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Thu, 26 Nov 2020 06:57:02 +0000 Subject: vnc: Fix a memleak in vnc_display_connect() Free the 'sioc' when the qio_channel_socket_connect_sync() fails. Reported-by: Euler Robot Signed-off-by: Alex Chen Reviewed-by: Li Qiang Reviewed-by: Laurent Vivier Message-Id: <20201126065702.35095-1-alex.chen@huawei.com> Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vnc.c b/ui/vnc.c index a0bf750767..d4854d351b 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3805,6 +3805,7 @@ static int vnc_display_connect(VncDisplay *vd, sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "vnc-reverse"); if (qio_channel_socket_connect_sync(sioc, saddr[0], errp) < 0) { + object_unref(OBJECT(sioc)); return -1; } vnc_connect(vd, sioc, false, false); -- cgit v1.2.3-55-g7522