From: Vladimir Sementsov-Ogievskiy Date: Tue, 24 Mar 2020 15:59:21 +0000 (+0300) Subject: block: fix bdrv_root_attach_child forget to unref child_bs X-Git-Tag: v5.0.0-rc1~8^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a26df203c7b2e4a585fc6014358b57a948fb7e0;p=thirdparty%2Fqemu.git block: fix bdrv_root_attach_child forget to unref child_bs 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 that. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20200324155921.23822-1-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index af3faf664ea..2e3905c99e8 100644 --- a/block.c +++ b/block.c @@ -2617,6 +2617,7 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs, error_propagate(errp, local_err); g_free(child); bdrv_abort_perm_update(child_bs); + bdrv_unref(child_bs); return NULL; } }