From: Dariusz Stojaczyk Date: Fri, 26 May 2017 11:59:14 +0000 (+0200) Subject: vhost: fix guest pages memory leak X-Git-Tag: spdx-start~2994 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=29c7c2fdaa4e88eebee6e3abaa15858d9616b1aa;p=dpdk.git vhost: fix guest pages memory leak 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. Fixes: e246896178e6 ("vhost: get guest/host physical address mappings") Cc: stable@dpdk.org Signed-off-by: Dariusz Stojaczyk Reviewed-by: Jens Freimann Acked-by: Yuanhan Liu --- diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 437e41f8be..92db73a1af 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;