From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buJJN-0005RK-0Y for qemu-devel@nongnu.org; Wed, 12 Oct 2016 09:11:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buJJH-0004H3-PT for qemu-devel@nongnu.org; Wed, 12 Oct 2016 09:11:07 -0400 Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]:36236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buJJH-0004Gu-L9 for qemu-devel@nongnu.org; Wed, 12 Oct 2016 09:11:03 -0400 Received: by mail-io0-x244.google.com with SMTP id o141so3010968ioe.3 for ; Wed, 12 Oct 2016 06:11:03 -0700 (PDT) Message-ID: <57fe3666.018b240a.e96e4.4825@mx.google.com> From: Li Qiang Date: Wed, 12 Oct 2016 06:10:56 -0700 Subject: [Qemu-devel] [PATCH v2] 9pfs: fix memory leak in v9fs_write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: groug@kaod.org, qemu-devel@nongnu.org Cc: Li Qiang 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 --- 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); -- 1.8.3.1