All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: dso_load - move name malloc to when needed
@ 2013-01-14 17:46 David Ahern
  2013-01-25 11:47 ` [tip:perf/core] perf symbols: Move name malloc to when needed in dso__load tip-bot for David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2013-01-14 17:46 UTC (permalink / raw)
  To: acme, linux-kernel; +Cc: David Ahern

memory is currently leaked on some paths.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/util/symbol.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 61edfd0..e9c0c3a 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -775,10 +775,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) {
@@ -802,6 +798,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.
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-25 11:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 17:46 [PATCH] perf: dso_load - move name malloc to when needed David Ahern
2013-01-25 11:47 ` [tip:perf/core] perf symbols: Move name malloc to when needed in dso__load tip-bot for David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.