[dpdk-dev] [PATCH] lib/librte_vhost: fix memory leak
Yong Wang
wang.yong19 at zte.com.cn
Wed Jan 4 04:57:55 CET 2017
In function vhost_new_device(), current code dose not free 'dev'
in "i == MAX_VHOST_DEVICE" condition statements. It will lead to a
memory leak.
Signed-off-by: Yong Wang <wang.yong19 at zte.com.cn>
---
lib/librte_vhost/vhost.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 31825b8..e415093 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -250,6 +250,7 @@ struct virtio_net *
if (i == MAX_VHOST_DEVICE) {
RTE_LOG(ERR, VHOST_CONFIG,
"Failed to find a free slot for new device.\n");
+ rte_free(dev);
return -1;
}
--
1.8.3.1
More information about the dev
mailing list