diff mbox series

[PULL,2/6] block: fix bdrv_root_attach_child forget to unref child_bs

Message ID 20200327151950.11820-3-kwolf@redhat.com
State New
Headers show
Series [PULL,1/6] block/iscsi:use the flags in iscsi_open() prevent Clang warning | expand

Commit Message

Kevin Wolf March 27, 2020, 3:19 p.m. UTC
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

bdrv_root_attach_child promises to drop child_bs reference on failure.
It does it on first handled failure path, but not on the second. Fix

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200324155921.23822-1-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
 block.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series


diff --git a/block.c b/block.c
index af3faf664e..2e3905c99e 100644
--- a/block.c
+++ b/block.c
@@ -2617,6 +2617,7 @@  BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
             error_propagate(errp, local_err);
+            bdrv_unref(child_bs);
             return NULL;