cmdline: free on exit

Malloc cl in the cmdline_stdin_new function, so release in the
cmdline_stdin_exit function is logical, so that cl will not be
released alone.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Zhihong Peng <zhihongx.peng@intel.com>
This commit is contained in:
Zhihong Peng 2021-10-18 21:58:50 +08:00 committed by Thomas Monjalon
parent f8f8dc2890
commit 6ad06203a5
4 changed files with 4 additions and 2 deletions

View File

@ -233,7 +233,6 @@ main(int argc, char **argv)
cmdline_interact(cl);
cmdline_stdin_exit(cl);
cmdline_free(cl);
}
#endif
ret = 0;

View File

@ -180,7 +180,6 @@ test_cmdline_socket_fns(void)
/* void functions */
cmdline_stdin_exit(NULL);
cmdline_free(cl);
return 0;
error:
printf("Error: function accepted null parameter!\n");

View File

@ -325,6 +325,9 @@ API Changes
removed. Its usages have been replaced by a new function
``rte_kvargs_get_with_value()``.
* cmdline: ``cmdline_stdin_exit()`` now frees the ``cmdline`` structure.
Calls to ``cmdline_free()`` after it need to be deleted from applications.
* cmdline: Made ``cmdline`` structure definition hidden on Linux and FreeBSD.
* cmdline: Made ``rdline`` structure definition hidden. Functions are added

View File

@ -53,4 +53,5 @@ cmdline_stdin_exit(struct cmdline *cl)
return;
terminal_restore(cl);
cmdline_free(cl);
}