diff mbox

[v2] mirror: Fix resource leak when bdrv_getlength fails

Message ID 1398766149-26197-1-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng April 29, 2014, 10:09 a.m. UTC
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>

---
v2: Don't call block_job_completed twice. (Kevin)

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/mirror.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kevin Wolf April 29, 2014, 11:44 a.m. UTC | #1
Am 29.04.2014 um 12:09 hat Fam Zheng geschrieben:
> 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>
> 
> ---
> v2: Don't call block_job_completed twice. (Kevin)
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/block/mirror.c b/block/mirror.c
index 36f4f8e..2f0361e 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;