From: "Bernard.Iremonger" <bernard.iremon...@intel.com> The dyn_tokens array is initialised at the beginning of the cmdline_parse function. However when the inst_num variable is incremented later in the function the dyn_tokens array is not reinitialised so the tokens from the previous command are used.
The solution is to initialise the dyn_tokens array in the while(inst) loop. Fixes: 4fffc05a2b2c ("cmdline: support dynamic tokens") CC: sta...@dpdk.org Signed-off-by: Bernard Iremonger <bernard.iremon...@intel.com> --- lib/librte_cmdline/cmdline_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c index b814880..9ee28b8 100644 --- a/lib/librte_cmdline/cmdline_parse.c +++ b/lib/librte_cmdline/cmdline_parse.c @@ -276,7 +276,6 @@ return CMDLINE_PARSE_BAD_ARGS; ctx = cl->ctx; - memset(&dyn_tokens, 0, sizeof(dyn_tokens)); /* * - look if the buffer contains at least one line @@ -319,6 +318,7 @@ inst = ctx[inst_num]; while (inst) { debug_printf("INST %d\n", inst_num); + memset(&dyn_tokens, 0, sizeof(dyn_tokens)); /* fully parsed */ tok = match_inst(inst, buf, 0, tmp_result.buf, -- 1.9.1