Skip to content

Commit

Permalink
perf symbols: Move name malloc to when needed in dso__load
Browse files Browse the repository at this point in the history
Memory is currently leaked on some paths.

Signed-off-by: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/1358185607-90799-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
David Ahern authored and Arnaldo Carvalho de Melo committed Jan 24, 2013
1 parent 9811360 commit 164c800
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,10 +768,6 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
else
machine = NULL;

name = malloc(PATH_MAX);
if (!name)
return -1;

dso->adjust_symbols = 0;

if (strncmp(dso->name, "/tmp/perf-", 10) == 0) {
Expand All @@ -795,6 +791,10 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
if (machine)
root_dir = machine->root_dir;

name = malloc(PATH_MAX);
if (!name)
return -1;

/* Iterate over candidate debug images.
* Keep track of "interesting" ones (those which have a symtab, dynsym,
* and/or opd section) for processing.
Expand Down

0 comments on commit 164c800

Please sign in to comment.