DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
To: dev@dpdk.org
Cc: kirill.rybalchenko@intel.com, andrey.chilikin@intel.com,
	jingjing.wu@intel.com
Subject: [dpdk-dev] [PATCH] app/testpmd: fix potential memory leak
Date: Thu,  2 Nov 2017 10:13:41 +0000	[thread overview]
Message-ID: <1509617621-24850-1-git-send-email-kirill.rybalchenko@intel.com> (raw)

Fix potential memory leak in cmd_ddp_info_parsed() function.

Fixes: a8e005696c7b ("app/testpmd: get ddp profile protocol info")

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.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 3b691fe..eb044e7 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -14362,7 +14362,7 @@ cmd_ddp_info_parsed(
 	uint32_t dev_num = 0;
 	struct rte_pmd_i40e_ddp_device_id *devs;
 	uint32_t proto_num = 0;
-	struct rte_pmd_i40e_proto_info *proto;
+	struct rte_pmd_i40e_proto_info *proto = NULL;
 	uint32_t pctype_num = 0;
 	struct rte_pmd_i40e_ptype_info *pctype;
 	uint32_t ptype_num = 0;
@@ -14541,9 +14541,10 @@ cmd_ddp_info_parsed(
 	free(ptype);
 	printf("\n");
 
-	free(proto);
 	ret = 0;
 no_print_return:
+	if (proto)
+		free(proto);
 #endif
 	if (ret == -ENOTSUP)
 		printf("Function not supported in PMD driver\n");
-- 
2.5.5

             reply	other threads:[~2017-11-02 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 10:13 Kirill Rybalchenko [this message]
2017-11-07  7:06 ` Ferruh Yigit
2017-11-07  7:07   ` Ferruh Yigit

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=1509617621-24850-1-git-send-email-kirill.rybalchenko@intel.com \
    --to=kirill.rybalchenko@intel.com \
    --cc=andrey.chilikin@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /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).