public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: dev@dpdk.org
Cc: "Kevin Traynor" <ktraynor@redhat.com>,
	stable@dpdk.org, "Aman Singh" <aman.deep.singh@intel.com>,
	"Thomas Monjalon" <thomas@monjalon.net>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Shani Peretz" <shperetz@nvidia.com>
Subject: [PATCH 4/4] app/testpmd: fix fd leak
Date: Thu, 12 Mar 2026 10:36:06 +0000	[thread overview]
Message-ID: <20260312103606.702617-5-ktraynor@redhat.com> (raw)
In-Reply-To: <20260312103606.702617-1-ktraynor@redhat.com>

In error cases, the fd was not being closed.

Add label for error case that will close the fd.

Fixes: 1303b50a9c21 ("app/testpmd: add commands to dump mbuf history")
Cc: stable@dpdk.org

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 app/test-pmd/cmdline.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ab85f4e0ad..365f780aac 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9359,5 +9359,5 @@ static void cmd_dump_mbuf_history_parsed(void *parsed_result,
 					"Failed to find mempool '%s'\n",
 					res->name);
-			return;
+			goto out_close;
 		}
 		rte_mbuf_history_dump_mempool(out, mp);
@@ -9372,5 +9372,5 @@ static void cmd_dump_mbuf_history_parsed(void *parsed_result,
 			cmdline_printf(cl,
 					"Invalid mbuf pointer format. Use 0x<address>\n");
-			return;
+			goto out_close;
 		}
 		mbuf = (struct rte_mbuf *)mbuf_addr;
@@ -9382,4 +9382,5 @@ static void cmd_dump_mbuf_history_parsed(void *parsed_result,
 	}
 
+out_close:
 	if (out != stdout)
 		fclose(out);
-- 
2.53.0


  parent reply	other threads:[~2026-03-12 10:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 10:36 [PATCH 0/4] Static analysis fixes Kevin Traynor
2026-03-12 10:36 ` [PATCH 1/4] vhost: fix resource leak Kevin Traynor
2026-03-17 14:46   ` Maxime Coquelin
2026-03-12 10:36 ` [PATCH 2/4] net/bnxt: fix uninitialized read Kevin Traynor
2026-03-12 16:57   ` Stephen Hemminger
2026-03-16 18:39     ` Thomas Monjalon
2026-03-12 18:45   ` Kishore Padmanabha
2026-03-12 10:36 ` [PATCH 3/4] app/testpmd: check for no arguments Kevin Traynor
2026-03-12 12:37   ` fengchengwen
2026-03-12 17:03     ` Stephen Hemminger
2026-03-12 23:59       ` fengchengwen
2026-03-13  9:24         ` Kevin Traynor
2026-03-14  7:57           ` fengchengwen
2026-03-16  9:47             ` Kevin Traynor
2026-03-12 10:36 ` Kevin Traynor [this message]
2026-03-17 15:52   ` [PATCH 4/4] app/testpmd: fix fd leak Thomas Monjalon
2026-03-17 15:55 ` [PATCH 0/4] Static analysis fixes Thomas Monjalon

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=20260312103606.702617-5-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=shperetz@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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