[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347136614-25598-8-git-send-email-acme@infradead.org>
Date: Sat, 8 Sep 2012 17:36:52 -0300
From: Arnaldo Carvalho de Melo <acme@...radead.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
Irina Tirdea <irina.tirdea@...il.com>,
Pekka Enberg <penberg@...nel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 7/9] perf annotate: Make a copy of filename for passing to basename
From: David Ahern <dsahern@...il.com>
The basename function may modify the string passed to it, so the string
should not be marked const.
Signed-off-by: David Ahern <dsahern@...il.com>
Acked-by: Pekka Enberg <penberg@...nel.org>
Cc: Irina Tirdea <irina.tirdea@...il.com>
Cc: Pekka Enberg <penberg@...nel.org>
Link: http://lkml.kernel.org/r/1347116812-93646-2-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/annotate.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 51ef69c..04eafd3 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -984,7 +984,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
int context)
{
struct dso *dso = map->dso;
- const char *filename = dso->long_name, *d_filename;
+ char *filename;
+ const char *d_filename;
struct annotation *notes = symbol__annotation(sym);
struct disasm_line *pos, *queue = NULL;
u64 start = map__rip_2objdump(map, sym->start);
@@ -992,6 +993,10 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
int more = 0;
u64 len;
+ filename = strdup(dso->long_name);
+ if (!filename)
+ return -ENOMEM;
+
if (full_paths)
d_filename = filename;
else
@@ -1042,6 +1047,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
}
}
+ free(filename);
+
return more;
}
--
1.7.1
--
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