summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Chen2020-11-26 07:57:02 +0100
committerGerd Hoffmann2021-01-15 11:22:43 +0100
commit5f8679fe46d78acfa5fc43a3fd6b3fe95525d9bd (patch)
tree0192a1011a204260e6cddaafcb47ba96834ac176
parentui: add support for remote power control to VNC server (diff)
downloadqemu-5f8679fe46d78acfa5fc43a3fd6b3fe95525d9bd.tar.gz
qemu-5f8679fe46d78acfa5fc43a3fd6b3fe95525d9bd.tar.xz
qemu-5f8679fe46d78acfa5fc43a3fd6b3fe95525d9bd.zip
vnc: Fix a memleak in vnc_display_connect()
Free the 'sioc' when the qio_channel_socket_connect_sync() fails. Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Alex Chen <alex.chen@huawei.com> Reviewed-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20201126065702.35095-1-alex.chen@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--ui/vnc.c1
1 files changed, 1 insertions, 0 deletions
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);