From 8794fc68736fda80d7191f100c03c960a5ef1224 Mon Sep 17 00:00:00 2001 From: Li Qiang Date: Tue, 11 Oct 2016 09:27:45 +0200 Subject: [PATCH 3/4] 9pfs: fix potential host memory leak in v9fs_read 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 Signed-off-by: Greg Kurz --- 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 dfe293d..54e18a2 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1812,14 +1812,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) { -- 2.1.4