* [PATCH] tools: lib: traceevent: parse-filter.c: Cleaning up memory leak
@ 2014-06-01 11:36 Rickard Strandqvist
2014-06-03 2:19 ` Steven Rostedt
2014-06-03 3:11 ` Namhyung Kim
0 siblings, 2 replies; 3+ messages in thread
From: Rickard Strandqvist @ 2014-06-01 11:36 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Rickard Strandqvist, Steven Rostedt, linux-kernel
There is a risk for memory leak in when something unexpected happens
and the function returns.
This was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
tools/lib/traceevent/parse-filter.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index b502344..5865c9e 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -1492,8 +1492,10 @@ static int copy_filter_type(struct event_filter *filter,
arg->boolean.value = 0;
filter_type = add_filter_type(filter, event->id);
- if (filter_type == NULL)
+ if (filter_type == NULL) {
+ free_arg(arg);
return -1;
+ }
filter_type->filter = arg;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tools: lib: traceevent: parse-filter.c: Cleaning up memory leak
2014-06-01 11:36 [PATCH] tools: lib: traceevent: parse-filter.c: Cleaning up memory leak Rickard Strandqvist
@ 2014-06-03 2:19 ` Steven Rostedt
2014-06-03 3:11 ` Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2014-06-03 2:19 UTC (permalink / raw)
To: Rickard Strandqvist; +Cc: Arnaldo Carvalho de Melo, Namhyung Kim, linux-kernel
On Sun, 1 Jun 2014 13:36:56 +0200
Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> wrote:
> There is a risk for memory leak in when something unexpected happens
> and the function returns.
>
> This was largely found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
-- Steve
> ---
> tools/lib/traceevent/parse-filter.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
> index b502344..5865c9e 100644
> --- a/tools/lib/traceevent/parse-filter.c
> +++ b/tools/lib/traceevent/parse-filter.c
> @@ -1492,8 +1492,10 @@ static int copy_filter_type(struct event_filter *filter,
> arg->boolean.value = 0;
>
> filter_type = add_filter_type(filter, event->id);
> - if (filter_type == NULL)
> + if (filter_type == NULL) {
> + free_arg(arg);
> return -1;
> + }
>
> filter_type->filter = arg;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools: lib: traceevent: parse-filter.c: Cleaning up memory leak
2014-06-01 11:36 [PATCH] tools: lib: traceevent: parse-filter.c: Cleaning up memory leak Rickard Strandqvist
2014-06-03 2:19 ` Steven Rostedt
@ 2014-06-03 3:11 ` Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2014-06-03 3:11 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Steven Rostedt, linux-kernel
Hi Rickard,
On Sun, 1 Jun 2014 13:36:56 +0200, Rickard Strandqvist wrote:
> There is a risk for memory leak in when something unexpected happens
> and the function returns.
>
> This was largely found by using a static code analysis program called cppcheck.
Nice work!
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-03 3:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01 11:36 [PATCH] tools: lib: traceevent: parse-filter.c: Cleaning up memory leak Rickard Strandqvist
2014-06-03 2:19 ` Steven Rostedt
2014-06-03 3:11 ` Namhyung Kim
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).