From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5ohL-0000wq-9P for qemu-devel@nongnu.org; Tue, 21 Jan 2014 22:41:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5ohG-0003KP-RS for qemu-devel@nongnu.org; Tue, 21 Jan 2014 22:41:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5ohG-0003KK-J7 for qemu-devel@nongnu.org; Tue, 21 Jan 2014 22:41:46 -0500 Date: Wed, 22 Jan 2014 11:41:43 +0800 From: Fam Zheng Message-ID: <20140122034143.GA24497@T430.redhat.com> References: <93A91DC620F1514FB39E878E5131C8CF0E360A4F@nkgeml511-mbx.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93A91DC620F1514FB39E878E5131C8CF0E360A4F@nkgeml511-mbx.china.huawei.com> Subject: Re: [Qemu-devel] [PATCH] drive-mirror: fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Chentao (Boby)" Cc: "Zhangmin (Rudy)" , Qinling , qemu-devel , "Wubin (H)" , "Wangting (Kathy)" Hi, The patch itself looks good to me, but it has too many extra empty lines interleaved. Please try to use "git send-email" to submit your patches, for more information, follow the instructions as in: http://wiki.qemu.org/Contribute/SubmitAPatch On Tue, 01/21 11:43, Chentao (Boby) wrote: > In the function mirror_iteration() -> qemu_iovec_init(), it alloc memory for op->qiov.iov, when the write request call back, s/alloc/allocates/ s/call back/calls back/ > > > > but in the function mirror_iteration_done(), it only free the op, not free the op->qiov.iov, so this cause memory leak. s/free/frees/ s/cause/causes/ > > > > Signed-off-by: Zhang Min > Unnecessary notation here. > > --- > > 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); } > > -- > >