aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 20:16:43 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-25 10:49:28 -0500
commit8e16017d497e9bb37c8c3c5ed1edb8d6adeebf3a (patch)
treede01880f427373e595529d88e369b9c5c42e0dab /tools
parent237a7e04a1a4461843a998fae78517dbbd08602e (diff)
perf tools: Use memdup in map__clone
We have memdup() exactly for that, remove open coded dup. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-tnsoexrgv6u9l125srq2c7su@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/map.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index b6b163642c7d..6fcb9de62340 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -11,6 +11,7 @@
11#include "strlist.h" 11#include "strlist.h"
12#include "vdso.h" 12#include "vdso.h"
13#include "build-id.h" 13#include "build-id.h"
14#include <linux/string.h>
14 15
15const char *map_type__name[MAP__NR_TYPES] = { 16const char *map_type__name[MAP__NR_TYPES] = {
16 [MAP__FUNCTION] = "Functions", 17 [MAP__FUNCTION] = "Functions",
@@ -213,12 +214,7 @@ struct symbol *map__find_symbol_by_name(struct map *map, const char *name,
213 214
214struct map *map__clone(struct map *map) 215struct map *map__clone(struct map *map)
215{ 216{
216 struct map *clone = malloc(sizeof(*clone)); 217 return memdup(map, sizeof(*map));
217
218 if (clone != NULL)
219 memcpy(clone, map, sizeof(*clone));
220
221 return clone;
222} 218}
223 219
224int map__overlap(struct map *l, struct map *r) 220int map__overlap(struct map *l, struct map *r)