From: Yong Wang Date: Wed, 4 Jan 2017 03:57:55 +0000 (-0500) Subject: vhost: fix memory leak X-Git-Tag: spdx-start~5177 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5731d6acc7fe1f76ed895d08821b51dd5c817bd0;p=dpdk.git vhost: fix memory leak 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. Fixes: 45ca9c6f7bc6 ("vhost: get rid of linked list for devices") Cc: stable@dpdk.org Signed-off-by: Yong Wang Acked-by: Yuanhan Liu --- diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 31825b82bc..e4150934be 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -250,6 +250,7 @@ vhost_new_device(void) 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; }