From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5sfm-0003C7-A6 for qemu-devel@nongnu.org; Wed, 22 Jan 2014 02:56:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5sfh-0002Pj-Ee for qemu-devel@nongnu.org; Wed, 22 Jan 2014 02:56:30 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:57186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5sfg-0002Nh-Pc for qemu-devel@nongnu.org; Wed, 22 Jan 2014 02:56:25 -0500 Message-ID: <52DF7998.1000601@huawei.com> Date: Wed, 22 Jan 2014 15:56:08 +0800 From: Zhang Min MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] drive-mirror:fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Fam Zheng Cc: rudy.zhangmin@huawei.com, 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 --- 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