Should free the memory which allocated by strdup().

Fixes: 035b6a4f4bba ("examples/qos_sched: fix out-of-bounds option parsing")
Cc: sta...@dpdk.org

Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
---
 examples/qos_sched/args.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c
index e97273152a..8d61d3e454 100644
--- a/examples/qos_sched/args.c
+++ b/examples/qos_sched/args.c
@@ -103,8 +103,10 @@ app_parse_opt_vals(const char *conf_str, char separator, 
uint32_t n_vals, uint32
 
        n_tokens = rte_strsplit(string, strnlen(string, 32), tokens, n_vals, 
separator);
 
-       if (n_tokens > MAX_OPT_VALUES)
+       if (n_tokens > MAX_OPT_VALUES) {
+               free(string);
                return -1;
+       }
 
        for (i = 0; i < n_tokens; i++)
                opt_vals[i] = (uint32_t)atol(tokens[i]);
-- 
2.17.1

Reply via email to