Skip to content

Commit

Permalink
mirror: Fix resource leak when bdrv_getlength fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fam Zheng authored and kevmw committed Apr 29, 2014
1 parent e855e4f commit 373df5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/mirror.c
Expand Up @@ -325,8 +325,8 @@ static void coroutine_fn mirror_run(void *opaque)

s->common.len = bdrv_getlength(bs);
if (s->common.len <= 0) {
block_job_completed(&s->common, s->common.len);
return;
ret = s->common.len;
goto immediate_exit;
}

length = DIV_ROUND_UP(s->common.len, s->granularity);
Expand Down

0 comments on commit 373df5b

Please sign in to comment.