This patch fixes a memory leak.
virtio_net::guest_pages is allocated in vhost_setup_mem_table(),
reallocated in add_one_guest_page(), but never freed.

Signed-off-by: Dariusz Stojaczyk <dariuszx.stojac...@intel.com>
---
v2: remove gerrit id
 lib/librte_vhost/vhost_user.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 5c8058b..2cc0b66 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -114,6 +114,10 @@ vhost_backend_cleanup(struct virtio_net *dev)
                rte_free(dev->mem);
                dev->mem = NULL;
        }
+
+       free(dev->guest_pages);
+       dev->guest_pages = NULL;
+
        if (dev->log_addr) {
                munmap((void *)(uintptr_t)dev->log_addr, dev->log_size);
                dev->log_addr = 0;
-- 
2.7.4

Reply via email to