qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] 9pfs: fix potential host memory leak in v9fs_read


From: Li Qiang
Subject: [Qemu-devel] [PATCH] 9pfs: fix potential host memory leak in v9fs_read
Date: Mon, 26 Sep 2016 21:42:26 -0700

From: Li Qiang <address@hidden>

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]