qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] drive-mirror:fix memory leak


From: Zhang Min
Subject: [Qemu-devel] [PATCH] drive-mirror:fix memory leak
Date: Wed, 22 Jan 2014 15:56:08 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

In the function mirror_iteration() -> qemu_iovec_init(),
it allocates memory for op->qiov.iov, when the write request calls back,
but in the function mirror_iteration_done(), it only frees the op,
not free the op->qiov.iov, so this causes memory leak.

Signed-off-by: Zhang Min <address@hidden>
---
 block/mirror.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/block/mirror.c b/block/mirror.c
index 2932bab..9840840 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -96,6 +96,7 @@ static void mirror_iteration_done(MirrorOp *op, int ret)
         bitmap_set(s->cow_bitmap, chunk_num, nb_chunks);
     }

+    g_free(op->qiov.iov);
     g_slice_free(MirrorOp, op);
     qemu_coroutine_enter(s->common.co, NULL);
 }
-- 
1.7.3.1.msysgit.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]