DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: fix memory leak
@ 2018-05-02 10:26 Jianfeng Tan
  2018-05-02 11:09 ` Olivier Matz
  0 siblings, 1 reply; 3+ messages in thread
From: Jianfeng Tan @ 2018-05-02 10:26 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz, Jianfeng Tan

params is not freed if pthread_create() fails. The fix is
straight-forward.

Fixes: 3d09a6e26d8b ("eal: fix threads block on barrier")

Reported-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 lib/librte_eal/common/eal_common_thread.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
index 5f0c61f..c18a112 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -183,8 +183,10 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name,
 	pthread_barrier_init(&params->configured, NULL, 2);
 
 	ret = pthread_create(thread, attr, rte_thread_init, (void *)params);
-	if (ret != 0)
+	if (ret != 0) {
+		free(params);
 		return ret;
+	}
 
 	if (name != NULL) {
 		ret = rte_thread_setname(*thread, name);
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] eal: fix memory leak
  2018-05-02 10:26 [dpdk-dev] [PATCH] eal: fix memory leak Jianfeng Tan
@ 2018-05-02 11:09 ` Olivier Matz
  2018-05-02 15:17   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2018-05-02 11:09 UTC (permalink / raw)
  To: Jianfeng Tan; +Cc: dev

On Wed, May 02, 2018 at 10:26:32AM +0000, Jianfeng Tan wrote:
> params is not freed if pthread_create() fails. The fix is
> straight-forward.
> 
> Fixes: 3d09a6e26d8b ("eal: fix threads block on barrier")
> 
> Reported-by: Olivier Matz <olivier.matz@6wind.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>

Reviewed-by: Olivier Matz <olivier.matz@6wind.com>

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

* Re: [dpdk-dev] [PATCH] eal: fix memory leak
  2018-05-02 11:09 ` Olivier Matz
@ 2018-05-02 15:17   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-05-02 15:17 UTC (permalink / raw)
  To: Jianfeng Tan; +Cc: dev, Olivier Matz

02/05/2018 13:09, Olivier Matz:
> On Wed, May 02, 2018 at 10:26:32AM +0000, Jianfeng Tan wrote:
> > params is not freed if pthread_create() fails. The fix is
> > straight-forward.
> > 
> > Fixes: 3d09a6e26d8b ("eal: fix threads block on barrier")
> > 
> > Reported-by: Olivier Matz <olivier.matz@6wind.com>
> > Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> 
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks

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

end of thread, other threads:[~2018-05-02 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02 10:26 [dpdk-dev] [PATCH] eal: fix memory leak Jianfeng Tan
2018-05-02 11:09 ` Olivier Matz
2018-05-02 15:17   ` Thomas Monjalon

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