From: Zhihong Peng Date: Mon, 18 Oct 2021 13:58:50 +0000 (+0800) Subject: cmdline: free on exit X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6ad06203a587a8ce10392d9224e9fbdcb77b3d5c;p=dpdk.git 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 Reviewed-by: Dmitry Kozlyuk Acked-by: Olivier Matz Tested-by: Zhihong Peng --- diff --git a/app/test/test.c b/app/test/test.c index 173d202e47..5194131026 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -233,7 +233,6 @@ main(int argc, char **argv) cmdline_interact(cl); cmdline_stdin_exit(cl); - cmdline_free(cl); } #endif ret = 0; diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c index 054ebf5e9d..f238094b07 100644 --- a/app/test/test_cmdline_lib.c +++ b/app/test/test_cmdline_lib.c @@ -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"); diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 9b1843eb09..450bcbb445 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -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 diff --git a/lib/cmdline/cmdline_socket.c b/lib/cmdline/cmdline_socket.c index 998e8ade25..ebd5343754 100644 --- a/lib/cmdline/cmdline_socket.c +++ b/lib/cmdline/cmdline_socket.c @@ -53,4 +53,5 @@ cmdline_stdin_exit(struct cmdline *cl) return; terminal_restore(cl); + cmdline_free(cl); }