From: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com, hemant.agrawal@nxp.com,
sachin.saxena@nxp.com, jananeex.m.parthasarathy@intel.com,
Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>,
stable@dpdk.org
Subject: [dpdk-stable] [PATCH] bus/fslmc: fix for resource leak coverity issue
Date: Tue, 10 Sep 2019 08:30:55 +0100 [thread overview]
Message-ID: <1568100655-20010-1-git-send-email-agalyax.babu.radhakrishnan@intel.com> (raw)
From: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
1 issue caught by 344967
Leaked_storage: Variable sep going out of scope leaks the
storage it points to.
When 'sep' is not null and sep_exist is 0, 'sep' is freed
before going out of scope of the function irrespective of
'addr' exists or not.
Coverity Issue: 344967
Fixes: e67a61614d0b ("bus/fslmc: support device iteration")
Cc: stable@dpdk.org
Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
---
drivers/bus/fslmc/fslmc_bus.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index a2f482516..60c34098c 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -291,10 +291,13 @@ rte_fslmc_parse(const char *name, void *addr)
goto err_out;
}
- if (addr)
+ if (addr) {
strcpy(addr, sep);
+ if (!sep_exists && sep)
+ free(sep);
+ return 0;
+ }
- return 0;
err_out:
if (!sep_exists && sep)
free(sep);
--
2.14.1
next reply other threads:[~2019-09-10 7:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 7:30 Agalya Babu RadhaKrishnan [this message]
2019-09-10 7:41 ` Babu Radhakrishnan, AgalyaX
2019-10-03 8:43 ` Sachin Saxena
2019-10-24 19:17 ` [dpdk-stable] [dpdk-dev] " David Marchand
2019-10-31 11:16 ` Sachin Saxena
2019-10-03 8:40 ` [dpdk-stable] " Sachin Saxena
2019-10-31 16:18 ` [dpdk-stable] [dpdk-dev] " David Marchand
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=1568100655-20010-1-git-send-email-agalyax.babu.radhakrishnan@intel.com \
--to=agalyax.babu.radhakrishnan@intel.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=jananeex.m.parthasarathy@intel.com \
--cc=reshma.pattan@intel.com \
--cc=sachin.saxena@nxp.com \
--cc=stable@dpdk.org \
/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).