[dpdk-dev] [PATCH v3] eal: fix resource leak

Daniel Mrzyglod danielx.t.mrzyglod at intel.com
Wed Oct 11 13:53:53 CEST 2017


Memory allocated in strdup is not free.

Coverity issue: 143257
Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id")
Cc: thomas at monjalon.net
Cc: stable at dpdk.org

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod at intel.com>
---
v3: 
* remove strdup because it's basically striped argv[0]
v2:
* Fix due to compilation errors
 
 lib/librte_eal/linuxapp/eal/eal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 1f07347..739b61a 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -763,7 +763,7 @@ rte_eal_init(int argc, char **argv)
 	}
 
 	logid = strrchr(argv[0], '/');
-	logid = strdup(logid ? logid + 1: argv[0]);
+	logid = logid ? logid + 1 : argv[0];
 
 	thread_id = pthread_self();
 
-- 
2.7.4



More information about the dev mailing list