From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bor2R-0003Hn-GZ for qemu-devel@nongnu.org; Tue, 27 Sep 2016 07:59:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bor2N-00018Z-J0 for qemu-devel@nongnu.org; Tue, 27 Sep 2016 07:59:07 -0400 Received: from mail-it0-x244.google.com ([2607:f8b0:4001:c0b::244]:34214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bor2N-00018M-BG for qemu-devel@nongnu.org; Tue, 27 Sep 2016 07:59:03 -0400 Received: by mail-it0-x244.google.com with SMTP id j69so769342itb.1 for ; Tue, 27 Sep 2016 04:59:03 -0700 (PDT) Message-ID: <57ea5f06.821e6b0a.4ee38.31ea@mx.google.com> From: Li Qiang Date: Tue, 27 Sep 2016 04:58:46 -0700 Subject: [Qemu-devel] [PATCH] 9pfs: fix potential host memory leak in v9fs_read List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aneesh.kumar@linux.vnet.ibm.com, groug@kaod.org, qemu-devel@nongnu.org Cc: Li Qiang From: Li Qiang In 9pfs read dispatch function, it doesn't free two QEMUIOVector object thus causing potential memory leak. This patch avoid this. Signed-off-by: Li Qiang --- hw/9pfs/9p.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 119ee58..543a791 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque) if (len < 0) { /* IO error return the error */ err = len; - goto out; + goto out_free_iovec; } } while (count < max_count && len > 0); err = pdu_marshal(pdu, offset, "d", count); if (err < 0) { - goto out; + goto out_free_iovec; } err += offset + count; +out_free_iovec: qemu_iovec_destroy(&qiov); qemu_iovec_destroy(&qiov_full); } else if (fidp->fid_type == P9_FID_XATTR) { -- 1.8.3.1