All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Shani Peretz <shperetz@nvidia.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>,
	Aman Singh <aman.deep.singh@intel.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>
Subject: Re: [PATCH] app/testpmd: fix memory leak in port flow configure
Date: Tue, 24 Mar 2026 07:36:53 -0700	[thread overview]
Message-ID: <20260324073653.07fe3625@phoenix.local> (raw)
In-Reply-To: <20260324081045.6022-1-shperetz@nvidia.com>

On Tue, 24 Mar 2026 10:10:44 +0200
Shani Peretz <shperetz@nvidia.com> wrote:

> When "flow configure" is issued multiple times on the same port,
> port_flow_configure() allocates a new job_list via calloc() without
> freeing the previous allocation, leaking it. The old pointer is
> simply overwritten.
> 
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...  
> 
> The patch fixes this by freeing the existing job_list before allocating
> the replacement.
> 
> Fixes: df503d757b36 ("app/testpmd: fix flow queue job leaks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shani Peretz <shperetz@nvidia.com>
> ---
>  app/test-pmd/config.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index f9f3c542a6..f0a784bf2f 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1836,6 +1836,7 @@ port_flow_configure(portid_t port_id,
>  	port->queue_sz = queue_attr->size;
>  	for (std_queue = 0; std_queue < nb_queue; std_queue++)
>  		attr_list[std_queue] = queue_attr;
> +	free(port->job_list);
>  	port->job_list = calloc(nb_queue, sizeof(*port->job_list));

You could use realloc here, but it doesn't matter much

  parent reply	other threads:[~2026-03-24 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24  8:10 [PATCH] app/testpmd: fix memory leak in port flow configure Shani Peretz
2026-03-24  8:44 ` Dariusz Sosnowski
2026-03-24 14:36 ` Stephen Hemminger [this message]
2026-03-24 15:56 ` Stephen Hemminger

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=20260324073653.07fe3625@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=shperetz@nvidia.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.