From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: Pavan Nikhilesh <pbhagavatula@marvell.com>,
Shijith Thotton <sthotton@marvell.com>, <jerinj@marvell.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH 2/3] event/cnxk: fix memory leak
Date: Sat, 12 Feb 2022 18:09:47 +0530 [thread overview]
Message-ID: <20220212123948.3394407-2-gmuthukrishn@marvell.com> (raw)
In-Reply-To: <20220212123948.3394407-1-gmuthukrishn@marvell.com>
Fix memory leaks reported in coverity scan.
Fixes: 8a3d58c189f ("event/cnxk: add option to control timer adapters")
Coverity issue: 374990 374991
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
drivers/event/cnxk/cnxk_tim_evdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c
index 4d22ac6ac3..af67235503 100644
--- a/drivers/event/cnxk/cnxk_tim_evdev.c
+++ b/drivers/event/cnxk/cnxk_tim_evdev.c
@@ -560,7 +560,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque)
char *f = s;
if (s == NULL || !strlen(s))
- return;
+ goto free;
while (*s) {
if (*s == '[')
@@ -579,6 +579,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque)
s++;
}
+free:
free(f);
}
@@ -607,7 +608,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque)
int i = 0;
if (str == NULL || !strlen(str))
- return;
+ goto free;
tok = strtok(str, "-");
while (tok != NULL && src[i] != ROC_TIM_CLK_SRC_INVALID) {
@@ -616,6 +617,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque)
i++;
}
+free:
free(str);
}
--
2.25.1
next prev parent reply other threads:[~2022-02-12 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-12 12:39 [PATCH 1/3] event/cnxk: fix incompatible casting of variables Gowrishankar Muthukrishnan
2022-02-12 12:39 ` Gowrishankar Muthukrishnan [this message]
2022-02-12 12:39 ` [PATCH 3/3] event/cnxk: fix uninitialized local variable Gowrishankar Muthukrishnan
2022-02-22 9:50 ` [PATCH 1/3] event/cnxk: fix incompatible casting of variables Jerin Jacob
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=20220212123948.3394407-2-gmuthukrishn@marvell.com \
--to=gmuthukrishn@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=pbhagavatula@marvell.com \
--cc=sthotton@marvell.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).