From: "Ji, Kai" <kai.ji@intel.com>
To: "Power, Ciara" <ciara.power@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH] app/crypto-perf: fix test file memory leak
Date: Mon, 13 Mar 2023 10:21:34 +0000 [thread overview]
Message-ID: <SN6PR11MB34086348F7AF70C2FE8B12EA81B99@SN6PR11MB3408.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230310132017.6900-1-ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Friday, March 10, 2023 1:20 PM
> To: dev@dpdk.org
> Cc: Ji, Kai <kai.ji@intel.com>; Power, Ciara <ciara.power@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] app/crypto-perf: fix test file memory leak
>
> A memory leak was detected using the AddressSanitizer tool, when running
> the crypto-perf application with a test vector file.
>
> The strdup function used returns a pointer to a null-terminated byte
> string, which must be freed after use. This patch frees the pointer in an
> error case, and also after a successful run.
>
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
> app/test-crypto-perf/cperf_options_parsing.c | 1 +
> app/test-crypto-perf/cperf_test_vector_parsing.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-
> crypto-perf/cperf_options_parsing.c
> index 8c9f632590..26136a52ae 100644
> --- a/app/test-crypto-perf/cperf_options_parsing.c
> +++ b/app/test-crypto-perf/cperf_options_parsing.c
> @@ -519,6 +519,7 @@ parse_test_file(struct cperf_options *opts,
> if (access(opts->test_file, F_OK) != -1)
> return 0;
> RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n");
> + free(opts->test_file);
>
> return -1;
> }
> diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-
> crypto-perf/cperf_test_vector_parsing.c
> index 98e46c3381..737d61d4af 100644
> --- a/app/test-crypto-perf/cperf_test_vector_parsing.c
> +++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
> @@ -30,6 +30,7 @@ free_test_vector(struct cperf_test_vector *vector,
> struct cperf_options *opts)
> rte_free(vector->cipher_key.data);
> rte_free(vector->auth_key.data);
> rte_free(vector->ciphertext.data);
> + free(opts->test_file);
> }
>
> rte_free(vector);
> --
> 2.25.1
prev parent reply other threads:[~2023-03-13 10:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 13:20 Ciara Power
2023-03-11 19:02 ` [EXT] " Akhil Goyal
2023-03-13 10:21 ` Ji, Kai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SN6PR11MB34086348F7AF70C2FE8B12EA81B99@SN6PR11MB3408.namprd11.prod.outlook.com \
--to=kai.ji@intel.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).