Re: [PATCH 1/4] perf stat: Basic support for TopDown in perf stat

From: Andi Kleen
Date: Wed Jun 01 2016 - 10:31:42 EST


On Wed, Jun 01, 2016 at 09:24:33AM -0500, Nilay Vaish wrote:
> On 24 May 2016 at 14:52, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
> > From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> >
> > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> > index 715a1128daeb..dab184d86816 100644
> > --- a/tools/perf/builtin-stat.c
> > +++ b/tools/perf/builtin-stat.c
> > @@ -59,10 +59,13 @@
> > #include "util/thread.h"
> > #include "util/thread_map.h"
> > #include "util/counts.h"
> > +#include "util/group.h"
> > #include "util/session.h"
> > #include "util/tool.h"
> > +#include "util/group.h"
> > #include "asm/bug.h"
>
> You have included util/group.h twice. Is this intentional?

No was a mistake thanks.

> Continuing with my comment from above memory leak, if i == off,
> topdown_attrs[0] will be NULL. So we would enter the else portion
> here and return -1. But we never free the string we allocated in the
> function topdown_filter_events(). I think we are leaking some memory
> though seems only about 3 bytes.

Right, however the process immediately exits afterwards, so it gets
cleaned up anyways.

-Andi


--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only