From 3cdfdf2a3303bb50d98c4f1689fc4b3745ea1e4f Mon Sep 17 00:00:00 2001 From: Emmanuel Roullit Date: Tue, 24 Jan 2017 21:26:56 +0100 Subject: [PATCH] devargs: reset driver name pointer on parsing failure The pointer set by strdup() needs to be cleared on failure to avoid a potential double-free from the caller. Found with clang static analysis: lib/librte_eal/common/eal_common_devargs.c:123:2: warning: Attempt to free released memory free(buf); ^~~~~~~~~ Fixes: 0fe11ec592b2 ("eal: add vdev init and uninit") Signed-off-by: Emmanuel Roullit --- lib/librte_eal/common/eal_common_devargs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index e403717be7..ffa8ad96f9 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -72,6 +72,7 @@ rte_eal_parse_devargs_str(const char *devargs_str, if (*drvargs == NULL) { free(*drvname); + *drvname = NULL; return -1; } return 0; -- 2.20.1