From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buKE4-0003qT-7G for qemu-devel@nongnu.org; Wed, 12 Oct 2016 10:09:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buKE0-0006l3-0O for qemu-devel@nongnu.org; Wed, 12 Oct 2016 10:09:43 -0400 Received: from 2.mo179.mail-out.ovh.net ([178.33.250.45]:55076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buKDz-0006kb-Ql for qemu-devel@nongnu.org; Wed, 12 Oct 2016 10:09:39 -0400 Received: from player792.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 8014DFFB567 for ; Wed, 12 Oct 2016 16:09:38 +0200 (CEST) Date: Wed, 12 Oct 2016 16:09:33 +0200 From: Greg Kurz Message-ID: <20161012160933.7e028645@bahia> In-Reply-To: <57fe3666.018b240a.e96e4.4825@mx.google.com> References: <57fe3666.018b240a.e96e4.4825@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] 9pfs: fix memory leak in v9fs_write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Li Qiang Cc: qemu-devel@nongnu.org, Li Qiang On Wed, 12 Oct 2016 06:10:56 -0700 Li Qiang wrote: > From: Li Qiang > > If an error occurs when marshal the transfer length to the guest, the > v9fs_write doesn't free an IO vector, thus leading a memory leak. > This patch fix this. > > Signed-off-by: Li Qiang > --- Good catch again! Reviewed-by: Greg Kurz > hw/9pfs/9p.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c > index 8b50bfb..c8cf8c2 100644 > --- a/hw/9pfs/9p.c > +++ b/hw/9pfs/9p.c > @@ -2090,7 +2090,7 @@ static void v9fs_write(void *opaque) > offset = 7; > err = pdu_marshal(pdu, offset, "d", total); > if (err < 0) { > - goto out; > + goto out_qiov; > } > err += offset; > trace_v9fs_write_return(pdu->tag, pdu->id, total, err);