block/copy-before-write: drop extra bdrv_unref on failure path

bdrv_attach_child() do bdrv_unref() on failure, so we shouldn't do it
by hand here.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210824083856.17408-12-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2021-08-24 11:38:33 +03:00 committed by Hanna Reitz
parent 3860c02019
commit 451532311a

View File

@ -201,7 +201,6 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
state->target = bdrv_attach_child(top, target, "target", &child_of_bds, state->target = bdrv_attach_child(top, target, "target", &child_of_bds,
BDRV_CHILD_DATA, errp); BDRV_CHILD_DATA, errp);
if (!state->target) { if (!state->target) {
bdrv_unref(target);
bdrv_unref(top); bdrv_unref(top);
return NULL; return NULL;
} }