[dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit
Peng, ZhihongX
zhihongx.peng at intel.com
Wed Oct 20 11:22:48 CEST 2021
> -----Original Message-----
> From: Peng, ZhihongX <zhihongx.peng at intel.com>
> Sent: Monday, October 18, 2021 9:59 PM
> To: olivier.matz at 6wind.com; dmitry.kozliuk at gmail.com
> Cc: dev at dpdk.org; Peng, ZhihongX <zhihongx.peng at intel.com>
> Subject: [PATCH v5] lib/cmdline: release cl when cmdline exit
>
> From: Zhihong Peng <zhihongx.peng at intel.com>
>
> 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")
> Cc: intel.com
>
> Signed-off-by: Zhihong Peng <zhihongx.peng at intel.com>
> ---
> app/test/test.c | 1 -
> app/test/test_cmdline_lib.c | 1 -
> doc/guides/rel_notes/release_21_11.rst | 3 +++
> lib/cmdline/cmdline_socket.c | 1 +
> 4 files changed, 4 insertions(+), 2 deletions(-)
>
> 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
> d5a09b4541..6bcfa6511e 100644
> --- a/app/test/test_cmdline_lib.c
> +++ b/app/test/test_cmdline_lib.c
> @@ -174,7 +174,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 d5435a64aa..6aa98d1e34 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -237,6 +237,9 @@ API Changes
> the crypto/security operation. This field will be used to communicate
> events such as soft expiry with IPsec in lookaside mode.
>
> +* cmdline: ``cmdline_stdin_exit()`` now frees the ``cmdline`` structure.
> + Calls to ``cmdline_free()`` after it need to be deleted from applications.
> +
>
> ABI Changes
> -----------
> 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);
> }
> --
> 2.25.1
Tested-by: Zhihong Peng <zhihongx.peng at intel.com>
More information about the dev
mailing list