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: [email protected]

Signed-off-by: Kevin Traynor <[email protected]>
---
 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

Reply via email to