DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test-pmd: Fix buffer leak in tm cmdline
@ 2018-07-04 10:18 Nithin Dabilpuram
  2018-07-04 13:44 ` Singh, Jasvinder
  0 siblings, 1 reply; 2+ messages in thread
From: Nithin Dabilpuram @ 2018-07-04 10:18 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev, kkanas, Nithin Dabilpuram

Free the buffer allocated for shared_shaper_id array in
case of configuration without shared shapers.

Signed-off-by: Nithin Dabilpuram <nithin.dabilpuram@cavium.com>
---
 app/test-pmd/cmdline_tm.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index c904e44..7c1601f 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -1599,10 +1599,12 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result,
 		np.shaper_profile_id = res->shaper_profile_id;
 
 	np.n_shared_shapers = n_shared_shapers;
-	if (np.n_shared_shapers)
+	if (np.n_shared_shapers) {
 		np.shared_shaper_id = &shared_shaper_id[0];
-	else
-		np.shared_shaper_id = NULL;
+	} else {
+		free(shared_shaper_id);
+		shared_shaper_id = NULL;
+	}
 
 	np.nonleaf.n_sp_priorities = res->n_sp_priorities;
 	np.stats_mask = res->stats_mask;
@@ -1758,10 +1760,12 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result,
 
 	np.n_shared_shapers = n_shared_shapers;
 
-	if (np.n_shared_shapers)
+	if (np.n_shared_shapers) {
 		np.shared_shaper_id = &shared_shaper_id[0];
-	else
-		np.shared_shaper_id = NULL;
+	} else {
+		free(shared_shaper_id);
+		shared_shaper_id = NULL;
+	}
 
 	np.leaf.cman = res->cman_mode;
 	np.leaf.wred.wred_profile_id = res->wred_profile_id;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] app/test-pmd: Fix buffer leak in tm cmdline
  2018-07-04 10:18 [dpdk-dev] [PATCH] app/test-pmd: Fix buffer leak in tm cmdline Nithin Dabilpuram
@ 2018-07-04 13:44 ` Singh, Jasvinder
  0 siblings, 0 replies; 2+ messages in thread
From: Singh, Jasvinder @ 2018-07-04 13:44 UTC (permalink / raw)
  To: Nithin Dabilpuram, Lu, Wenzhuo, Wu, Jingjing, Iremonger, Bernard
  Cc: dev, kkanas



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Nithin Dabilpuram
> Sent: Wednesday, July 4, 2018 11:18 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; kkanas@caviumnetworks.com; Nithin Dabilpuram
> <nithin.dabilpuram@cavium.com>
> Subject: [dpdk-dev] [PATCH] app/test-pmd: Fix buffer leak in tm cmdline
> 
> Free the buffer allocated for shared_shaper_id array in case of configuration
> without shared shapers.
> 
> Signed-off-by: Nithin Dabilpuram <nithin.dabilpuram@cavium.com>
> ---
>  app/test-pmd/cmdline_tm.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 

Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>

 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-04 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04 10:18 [dpdk-dev] [PATCH] app/test-pmd: Fix buffer leak in tm cmdline Nithin Dabilpuram
2018-07-04 13:44 ` Singh, Jasvinder

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).