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>
---
ui/vnc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ui/vnc.c b/ui/vnc.c
index 49235056f7..dae56e9493 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3743,6 +3743,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);
--
2.19.1
Alex Chen <alex.chen@huawei.com> 于2020年11月26日周四 下午3:10写道: > > 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> > --- > ui/vnc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ui/vnc.c b/ui/vnc.c > index 49235056f7..dae56e9493 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -3743,6 +3743,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); > -- > 2.19.1 > >
Le 26/11/2020 à 07:57, Alex Chen a écrit : > 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> > --- > ui/vnc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ui/vnc.c b/ui/vnc.c > index 49235056f7..dae56e9493 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -3743,6 +3743,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); > Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Le 26/11/2020 à 07:57, Alex Chen a écrit : > 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> > --- > ui/vnc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ui/vnc.c b/ui/vnc.c > index 49235056f7..dae56e9493 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -3743,6 +3743,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); > Applied to my trivial-patches branch. Thanks, Laurent
© 2016 - 2024 Red Hat, Inc.