From: Fam Zheng Date: Tue, 29 Apr 2014 10:09:09 +0000 (+0800) Subject: mirror: Fix resource leak when bdrv_getlength fails X-Git-Tag: qemu-xen-4.6.0-rc1~480^2~26 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=373df5b135b4a54e0abb394e9e703fef3ded093c;p=qemu-upstream-4.6-testing.git 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 Signed-off-by: Kevin Wolf --- diff --git a/block/mirror.c b/block/mirror.c index 95366adb3..403714c1e 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -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);