mirror: Fix resource leak when bdrv_getlength fails
The direct return will skip releasing of all the resouces at
immediate_exit, don't miss that.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 373df5b135
)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
@@ -325,8 +325,8 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||||||
|
|
||||||
s->common.len = bdrv_getlength(bs);
|
s->common.len = bdrv_getlength(bs);
|
||||||
if (s->common.len <= 0) {
|
if (s->common.len <= 0) {
|
||||||
block_job_completed(&s->common, s->common.len);
|
ret = s->common.len;
|
||||||
return;
|
goto immediate_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity;
|
length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity;
|
||||||
|
Reference in New Issue
Block a user