[dpdk-dev] [PATCH v4 2/3] vhost: free guest_pages in vhost_backend_cleanup()
Dariusz Stojaczyk
dariuszx.stojaczyk at intel.com
Fri May 26 13:59:14 CEST 2017
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.stojaczyk at 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
More information about the dev
mailing list