linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf test x86: Fit memory leak in sample_ustack()
@ 2014-04-19 15:16 Masanari Iida
  2014-04-19 22:19 ` Jiri Olsa
  2014-04-21 14:37 ` [PATCH/v2] " Masanari Iida
  0 siblings, 2 replies; 5+ messages in thread
From: Masanari Iida @ 2014-04-19 15:16 UTC (permalink / raw)
  To: a.p.zijlstra, jolsa, paulus, mingo, acme, linux-kernel; +Cc: Masanari Iida

buf is not freed, when kernel failed to get stack map
and return.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
---
 tools/perf/arch/x86/tests/dwarf-unwind.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c
index b602ad9..68f2711 100644
--- a/tools/perf/arch/x86/tests/dwarf-unwind.c
+++ b/tools/perf/arch/x86/tests/dwarf-unwind.c
@@ -26,6 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
 	map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp);
 	if (!map) {
 		pr_debug("failed to get stack map\n");
+		kfree(buf);
 		return -1;
 	}
 
-- 
1.9.2.468.g3f0c02a


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

* Re: [PATCH] perf test x86: Fit memory leak in sample_ustack()
  2014-04-19 15:16 [PATCH] perf test x86: Fit memory leak in sample_ustack() Masanari Iida
@ 2014-04-19 22:19 ` Jiri Olsa
  2014-04-19 22:33   ` Jiri Olsa
  2014-04-21 14:37 ` [PATCH/v2] " Masanari Iida
  1 sibling, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2014-04-19 22:19 UTC (permalink / raw)
  To: Masanari Iida; +Cc: a.p.zijlstra, paulus, mingo, acme, linux-kernel

On Sun, Apr 20, 2014 at 12:16:41AM +0900, Masanari Iida wrote:
> buf is not freed, when kernel failed to get stack map
> and return.
> 
> Signed-off-by: Masanari Iida <standby24x7@gmail.com>

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

> ---
>  tools/perf/arch/x86/tests/dwarf-unwind.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c
> index b602ad9..68f2711 100644
> --- a/tools/perf/arch/x86/tests/dwarf-unwind.c
> +++ b/tools/perf/arch/x86/tests/dwarf-unwind.c
> @@ -26,6 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
>  	map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp);
>  	if (!map) {
>  		pr_debug("failed to get stack map\n");
> +		kfree(buf);
>  		return -1;
>  	}
>  
> -- 
> 1.9.2.468.g3f0c02a
> 

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

* Re: [PATCH] perf test x86: Fit memory leak in sample_ustack()
  2014-04-19 22:19 ` Jiri Olsa
@ 2014-04-19 22:33   ` Jiri Olsa
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2014-04-19 22:33 UTC (permalink / raw)
  To: Masanari Iida; +Cc: a.p.zijlstra, paulus, mingo, acme, linux-kernel

On Sun, Apr 20, 2014 at 12:19:13AM +0200, Jiri Olsa wrote:
> On Sun, Apr 20, 2014 at 12:16:41AM +0900, Masanari Iida wrote:
> > buf is not freed, when kernel failed to get stack map
> > and return.
> > 
> > Signed-off-by: Masanari Iida <standby24x7@gmail.com>
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>
> 
> thanks,
> jirka
> 
> > ---
> >  tools/perf/arch/x86/tests/dwarf-unwind.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c
> > index b602ad9..68f2711 100644
> > --- a/tools/perf/arch/x86/tests/dwarf-unwind.c
> > +++ b/tools/perf/arch/x86/tests/dwarf-unwind.c
> > @@ -26,6 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
> >  	map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp);
> >  	if (!map) {
> >  		pr_debug("failed to get stack map\n");
> > +		kfree(buf);

and changing this to free(buf) ;-)

jirka

> >  		return -1;
> >  	}
> >  
> > -- 
> > 1.9.2.468.g3f0c02a
> > 

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

* [PATCH/v2] perf test x86: Fit memory leak in sample_ustack()
  2014-04-19 15:16 [PATCH] perf test x86: Fit memory leak in sample_ustack() Masanari Iida
  2014-04-19 22:19 ` Jiri Olsa
@ 2014-04-21 14:37 ` Masanari Iida
  2014-04-23 13:13   ` [tip:perf/urgent] perf tests x86: Fix " tip-bot for Masanari Iida
  1 sibling, 1 reply; 5+ messages in thread
From: Masanari Iida @ 2014-04-21 14:37 UTC (permalink / raw)
  To: a.p.zijlstra, paulus, mingo, acme, jolsa, linux-kernel; +Cc: Masanari Iida

buf is not freed, when program failed to get stack map

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/arch/x86/tests/dwarf-unwind.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c
index b602ad9..b8c0102 100644
--- a/tools/perf/arch/x86/tests/dwarf-unwind.c
+++ b/tools/perf/arch/x86/tests/dwarf-unwind.c
@@ -26,6 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
 	map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp);
 	if (!map) {
 		pr_debug("failed to get stack map\n");
+		free(buf);
 		return -1;
 	}
 
-- 
1.9.2.468.g3f0c02a


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

* [tip:perf/urgent] perf tests x86: Fix memory leak in sample_ustack()
  2014-04-21 14:37 ` [PATCH/v2] " Masanari Iida
@ 2014-04-23 13:13   ` tip-bot for Masanari Iida
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Masanari Iida @ 2014-04-23 13:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, standby24x7, jolsa

Commit-ID:  763d7f5f2718f085bab5a9e63308349728f3ad12
Gitweb:     http://git.kernel.org/tip/763d7f5f2718f085bab5a9e63308349728f3ad12
Author:     Masanari Iida <standby24x7@gmail.com>
AuthorDate: Sun, 20 Apr 2014 00:16:41 +0900
Committer:  Jiri Olsa <jolsa@redhat.com>
CommitDate: Wed, 23 Apr 2014 13:19:01 +0200

perf tests x86: Fix memory leak in sample_ustack()

The buf is not freed, when kernel failed to get stack map
and return.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Link: http://lkml.kernel.org/r/1398091024-7901-1-git-send-email-standby24x7@gmail.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/arch/x86/tests/dwarf-unwind.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c
index b602ad9..b8c0102 100644
--- a/tools/perf/arch/x86/tests/dwarf-unwind.c
+++ b/tools/perf/arch/x86/tests/dwarf-unwind.c
@@ -26,6 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
 	map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp);
 	if (!map) {
 		pr_debug("failed to get stack map\n");
+		free(buf);
 		return -1;
 	}
 

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

end of thread, other threads:[~2014-04-23 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-19 15:16 [PATCH] perf test x86: Fit memory leak in sample_ustack() Masanari Iida
2014-04-19 22:19 ` Jiri Olsa
2014-04-19 22:33   ` Jiri Olsa
2014-04-21 14:37 ` [PATCH/v2] " Masanari Iida
2014-04-23 13:13   ` [tip:perf/urgent] perf tests x86: Fix " tip-bot for Masanari Iida

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