aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-01-14 12:46:47 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 14:40:30 -0500
commit164c800e42657e586f6fd446b3d8d41cf1f815f1 (patch)
tree8e908cef842fb0d6569ee31de8dbcbd0cc4346e3 /tools/perf
parent9811360ec8b76a68599cb0629cebca026c93cfce (diff)
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')
-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)
768 else 768 else
769 machine = NULL; 769 machine = NULL;
770 770
771 name = malloc(PATH_MAX);
772 if (!name)
773 return -1;
774
775 dso->adjust_symbols = 0; 771 dso->adjust_symbols = 0;
776 772
777 if (strncmp(dso->name, "/tmp/perf-", 10) == 0) { 773 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)
795 if (machine) 791 if (machine)
796 root_dir = machine->root_dir; 792 root_dir = machine->root_dir;
797 793
794 name = malloc(PATH_MAX);
795 if (!name)
796 return -1;
797
798 /* Iterate over candidate debug images. 798 /* Iterate over candidate debug images.
799 * Keep track of "interesting" ones (those which have a symtab, dynsym, 799 * Keep track of "interesting" ones (those which have a symtab, dynsym,
800 * and/or opd section) for processing. 800 * and/or opd section) for processing.