summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-01-14 10:46:47 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 16:40:30 -0300
commit164c800e42657e586f6fd446b3d8d41cf1f815f1 (patch)
tree8e908cef842fb0d6569ee31de8dbcbd0cc4346e3 /tools/perf/util/symbol.c
parent9811360ec8b76a68599cb0629cebca026c93cfce (diff)
downloadblackbird-obmc-linux-164c800e42657e586f6fd446b3d8d41cf1f815f1.tar.gz
blackbird-obmc-linux-164c800e42657e586f6fd446b3d8d41cf1f815f1.zip
perf symbols: Move name malloc to when needed in dso__load
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>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 2960284d6ae1..daf95549e7b9 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -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) {
@@ -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.
OpenPOWER on IntegriCloud