[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131210120707.GB30001@gmail.com>
Date: Tue, 10 Dec 2013 13:07:07 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: linux-kernel@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Ben Cheng <bccheng@...gle.com>,
David Ahern <dsahern@...il.com>,
Dongsheng Yang <yangds.fnst@...fujitsu.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
Namhyung Kim <namhyung.kim@....com>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [GIT PULL 00/21] perf/core improvements and fixes
* Arnaldo Carvalho de Melo <acme@...stprotocols.net> wrote:
> Em Tue, Dec 10, 2013 at 12:47:57PM +0100, Ingo Molnar escreveu:
> > * Arnaldo Carvalho de Melo <acme@...stprotocols.net> wrote:
> > > Em Tue, Dec 10, 2013 at 12:12:29PM +0100, Ingo Molnar escreveu:
> > > > Hm, I've unpulled it because 'perf top' crashes on exit, in
> > > > dso__delete():
>
> > > 495 if (dso->sname_alloc)
> > > 496 free((char *)dso->short_name)
>
> > Btw., instead of trusting flags I'd argue that using the pointer as a
> > flag and clearing the pointer too is a much more robust freeing
> > pattern in general:
>
> > if (dso->short_name) {
> > free(dso->short_name);
> > dso->short_name = NULL;
> > }
> >
> > or so ...
>
> This is not an unusual idiom, if you look at
> tools/perf/util/ev{list,sel}.c, for instance, you'll see it in many
> destructors.
>
> In this case there is a micro optimization where sometimes the
> shortname is just a pointer to the tail part of the long name, hence
> the flag.
Sounds fair.
[btw., a tiny nit remains: the cast is probably unnecessary, free()
will take any pointer.]
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists