diff mbox series

[for-6.0,1/2] block/nbd: fix channel object leak

Message ID 20210409160406.1800272-2-rvkagan@yandex-team.ru (mailing list archive)
State New
Headers show
Series block/nbd: assorted bugfixes | expand

Commit Message

Roman Kagan April 9, 2021, 4:04 p.m. UTC
nbd_free_connect_thread leaks the channel object if it hasn't been
stolen.

Unref it and fix the leak.

Signed-off-by: Roman Kagan <rvkagan@yandex-team.ru>
---
 block/nbd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Vladimir Sementsov-Ogievskiy April 10, 2021, 7:43 a.m. UTC | #1
09.04.2021 19:04, Roman Kagan wrote:
> nbd_free_connect_thread leaks the channel object if it hasn't been
> stolen.
> 
> Unref it and fix the leak.
> 
> Signed-off-by: Roman Kagan<rvkagan@yandex-team.ru>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
diff mbox series

Patch

diff --git a/block/nbd.c b/block/nbd.c
index c26dc5a54f..d86df3afcb 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -385,6 +385,7 @@  static void nbd_free_connect_thread(NBDConnectThread *thr)
 {
     if (thr->sioc) {
         qio_channel_close(QIO_CHANNEL(thr->sioc), NULL);
+        object_unref(OBJECT(thr->sioc));
     }
     error_free(thr->err);
     qapi_free_SocketAddress(thr->saddr);