From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bokEZ-0003LS-KB for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:43:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bokET-0007MB-MJ for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:43:10 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:36256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bokET-0007Lz-G3 for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:43:05 -0400 Received: by mail-oi0-x244.google.com with SMTP id i193so167194oib.3 for ; Mon, 26 Sep 2016 21:43:05 -0700 (PDT) Message-ID: <57e9f8d8.a8059d0a.58e91.0d98@mx.google.com> From: Li Qiang Date: Mon, 26 Sep 2016 21:42:26 -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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index d960a2e..b1ff8e7 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1830,12 +1830,16 @@ static void v9fs_read(void *opaque) } while (len == -EINTR && !pdu->cancelled); if (len < 0) { /* IO error return the error */ + qemu_iovec_destroy(&qiov); + qemu_iovec_destroy(&qiov_full); err = len; goto out; } } while (count < max_count && len > 0); err = pdu_marshal(pdu, offset, "d", count); if (err < 0) { + qemu_iovec_destroy(&qiov); + qemu_iovec_destroy(&qiov_full); goto out; } err += offset + count; -- 1.8.3.1