Re: [PATCH 1/6] block: fix leak of tran in bdrv_root_attach_child

2021-05-03 Thread Vladimir Sementsov-Ogievskiy
03.05.2021 18:51, Alberto Garcia wrote: On Mon 03 May 2021 01:33:57 PM CEST, Vladimir Sementsov-Ogievskiy wrote: @@ -2918,12 +2918,18 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs, child_role, perm, shared_perm, opaque,

Re: [PATCH 1/6] block: fix leak of tran in bdrv_root_attach_child

2021-05-03 Thread Alberto Garcia
On Mon 03 May 2021 01:33:57 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > @@ -2918,12 +2918,18 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState > *child_bs, > child_role, perm, shared_perm, opaque, > &child, tran, errp

[PATCH 1/6] block: fix leak of tran in bdrv_root_attach_child

2021-05-03 Thread Vladimir Sementsov-Ogievskiy
bdrv_attach_child_common() doesn't require tran_finalize() on failure (it does tran_add() only on success path). Still tran_new() must be paired with tran_finalize() anyway, at least to free empty Transaction object itself. So, refactor the function for clean finalization code, same on all paths.