Messages in this thread | | | From | Arnaldo Carvalho de Melo <> | Date | Tue, 24 Sep 2019 16:20:46 -0300 | Subject | Re: [PATCH 3/3] perf, stat: Fix free memory access / memory leaks in metrics |
| |
Em Tue, Sep 24, 2019 at 04:44:18PM +0200, Jiri Olsa escreveu: > On Tue, Sep 24, 2019 at 07:08:56AM -0700, Andi Kleen wrote: > > > > expr__ctx_init(&pctx); > > > > + /* Must be first id entry */ > > > > + expr__add_id(&pctx, name, avg); > > > > > > hum, shouldn't u instead use strdup(name) instead of name? > > > > The cleanup loop later skips freeing the first entry. > > aaah, nice ;-) > > Acked-by: Jiri Olsa <jolsa@kernel.org>
Thanks, reproduced and applied, before the patch:
# perf stat -M IpB,IpCall,IpTB,IPC,Retiring_SMT,Frontend_Bound_SMT,Kernel_Utilization,CPU_Utilization --metric-only -a -I 1000 sleep 2 # time CPU_Utilization 1.000470810 free(): double free detected in tcache 2 Aborted (core dumped) #
- Arnaldo
| |