From 97e476ad7c89303b21deea5b87fa0f0612d50f5c Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Wed, 17 Oct 2018 16:30:13 +0200 Subject: [PATCH] devargs: fix variadic parsing memory leak rte_devargs_parsef will leak memory each time it is called. The device string must be freed. Fixes: a23bc2c4e01b ("devargs: add non-variadic parsing function") Cc: stable@dpdk.org Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_devargs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 69e9e32e9c..c1b06095e0 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -237,6 +237,7 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...) va_list ap; size_t len; char *dev; + int ret; if (da == NULL) return -EINVAL; @@ -255,7 +256,10 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...) vsnprintf(dev, len + 1, format, ap); va_end(ap); - return rte_devargs_parse(da, dev); + ret = rte_devargs_parse(da, dev); + + free(dev); + return ret; } int __rte_experimental -- 2.20.1