]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
mirror: Fix resource leak when bdrv_getlength fails
authorFam Zheng <famz@redhat.com>
Tue, 29 Apr 2014 10:09:09 +0000 (18:09 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 7 Aug 2014 08:24:19 +0000 (03:24 -0500)
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>
block/mirror.c

index 0ef41f999e405b295df1ee02666a4bcddf06200e..9a0a55940c741fb487894fdb39df0f8c49088452 100644 (file)
@@ -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;