From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: olivier.matz@6wind.com, Jianfeng Tan <jianfeng.tan@intel.com>
Subject: [dpdk-dev] [PATCH] eal: fix memory leak
Date: Wed, 2 May 2018 10:26:32 +0000 [thread overview]
Message-ID: <1525256792-24191-1-git-send-email-jianfeng.tan@intel.com> (raw)
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(¶ms->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
next reply other threads:[~2018-05-02 10:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-02 10:26 Jianfeng Tan [this message]
2018-05-02 11:09 ` Olivier Matz
2018-05-02 15:17 ` 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=1525256792-24191-1-git-send-email-jianfeng.tan@intel.com \
--to=jianfeng.tan@intel.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.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).