diff mbox series

[PULL,04/34] block/nbd: fix channel object leak

Message ID 20210615204756.281505-5-eblake@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/34] async: the main AioContext is only "current" if under the BQL | expand

Commit Message

Eric Blake June 15, 2021, 8:47 p.m. UTC
From: Roman Kagan <rvkagan@yandex-team.ru>

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: Eric Blake <eblake@redhat.com>
Message-Id: <20210610100802.5888-3-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/nbd.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/block/nbd.c b/block/nbd.c
index 616f9ae6c4da..f4b3407587df 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -381,6 +381,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);