aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Qiang <liqiang6-s@360.cn>2016-10-17 14:13:58 +0200
committerGreg Kurz <groug@kaod.org>2016-10-17 14:13:58 +0200
commite95c9a493a5a8d6f969e86c9f19f80ffe6587e19 (patch)
tree7ad3c15b013f1c2e513673c27505a95b0dbd3163
parentba42ebb863ab7d40adc79298422ed9596df8f73a (diff)
downloadqemu-e95c9a493a5a8d6f969e86c9f19f80ffe6587e19.zip
qemu-e95c9a493a5a8d6f969e86c9f19f80ffe6587e19.tar.gz
qemu-e95c9a493a5a8d6f969e86c9f19f80ffe6587e19.tar.bz2
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 <liqiang6-s@360.cn> Signed-off-by: Greg Kurz <groug@kaod.org>
-rw-r--r--hw/9pfs/9p.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 39a7e1d..ff94a62 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) {