DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: reset driver name pointer on failure
@ 2017-01-24 20:26 Emmanuel Roullit
  2017-01-29 22:35 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Emmanuel Roullit @ 2017-01-24 20:26 UTC (permalink / raw)
  To: david.marchand; +Cc: dev, stable

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: 3fe2e5fec82b ("eal: fix argument parsing check")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
---
 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 e403717be..ffa8ad96f 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.11.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-29 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 20:26 [dpdk-dev] [PATCH] eal: reset driver name pointer on failure Emmanuel Roullit
2017-01-29 22:35 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).