lkml.org 
[lkml]   [2014]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] perf: fix for double free in tools/perf stat
Date
Hi Yasser,

On Sat, 4 Oct 2014 11:37:57 -0400, Yasser Shalabi wrote:
> Fix for double free bug in tools/perf due to dangling thread_map pointer in perf_evlist struct.
> Code path excercised when perf stat -C switch is used but not set and is followed by another switch.
> Example: perf stat -C -e.
> Signed-off-by: Yasser Shalabi <yassershalabi@gmail.com>
>
> ---
> tools/perf/util/evlist.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 814e954..09af633 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -845,6 +845,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
>
> out_delete_threads:
> thread_map__delete(evlist->threads);
> + evlist->threads = 0;

Nitpick - I think NULL is preferred rather than 0.

Other than that,

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> return -1;
> }


\
 
 \ /
  Last update: 2014-10-07 11:01    [W:0.837 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site