qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] drive-mirror:fix memory leak
@ 2014-01-22  7:56 Zhang Min
  2014-01-22  8:27 ` Fam Zheng
  2014-01-22  9:42 ` Kevin Wolf
  0 siblings, 2 replies; 6+ messages in thread
From: Zhang Min @ 2014-01-22  7:56 UTC (permalink / raw)
  To: qemu-devel, Fam Zheng
  Cc: rudy.zhangmin, Qinling, Chentao (Boby), Wubin (H),
	Wangting (Kathy)

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 <rudy.zhangmin@huawei.com>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] drive-mirror: fix memory leak
@ 2014-01-21 11:43 Chentao (Boby)
  2014-01-22  3:41 ` Fam Zheng
  0 siblings, 1 reply; 6+ messages in thread
From: Chentao (Boby) @ 2014-01-21 11:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Qinling, Zhangmin (Rudy), Wubin (H), Chentao (Boby),
	Wangting (Kathy)

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

In the function mirror_iteration() -> qemu_iovec_init(), it alloc memory for op->qiov.iov, when the write request call back,



but in the function mirror_iteration_done(), it only free the op, not free the op->qiov.iov, so this cause memory leak.



Signed-off-by: Zhang Min <rudy.zhangmin@huawei.com<mailto:rudy.zhangmin@huawei.com>>

---

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);  }

--



[-- Attachment #2: Type: text/html, Size: 4613 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-22  9:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22  7:56 [Qemu-devel] [PATCH] drive-mirror:fix memory leak Zhang Min
2014-01-22  8:27 ` Fam Zheng
2014-01-22  9:42 ` Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2014-01-21 11:43 [Qemu-devel] [PATCH] drive-mirror: fix " Chentao (Boby)
2014-01-22  3:41 ` Fam Zheng
2014-01-22  6:53   ` Zhang Min

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).