diff options
author | Fam Zheng <famz@redhat.com> | 2014-04-29 18:09:09 +0800 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2014-08-07 03:24:19 -0500 |
commit | 520b3412643ed6907809a1e0711eae497aaa8b54 (patch) | |
tree | 208993f8c187f197e72c12f13ce604653fa6ff4d | |
parent | e0efb023c0409b80e703e18352f7ad1c6268ce0c (diff) | |
download | qemu-520b3412643ed6907809a1e0711eae497aaa8b54.tar.gz |
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 373df5b135b4a54e0abb394e9e703fef3ded093c)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | block/mirror.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/mirror.c b/block/mirror.c index 0ef41f999e..9a0a55940c 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 = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity; |