Skip to content

Commit

Permalink
vnc: Fix a memleak in vnc_display_connect()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Chen authored and kraxel committed Jan 15, 2021
1 parent 7b5fa0b commit 5f8679f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ui/vnc.c
Expand Up @@ -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);
Expand Down

0 comments on commit 5f8679f

Please sign in to comment.