From: Arnaldo Carvalho de Melo Date: Fri, 25 Jan 2013 01:16:43 +0000 (-0300) Subject: perf tools: Use memdup in map__clone X-Git-Tag: MMI-PSA29.97-13-9~15047^2~12^2~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8e16017d497e9bb37c8c3c5ed1edb8d6adeebf3a;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git perf tools: Use memdup in map__clone We have memdup() exactly for that, remove open coded dup. Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-tnsoexrgv6u9l125srq2c7su@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 @@ #include "strlist.h" #include "vdso.h" #include "build-id.h" +#include const char *map_type__name[MAP__NR_TYPES] = { [MAP__FUNCTION] = "Functions", @@ -213,12 +214,7 @@ struct symbol *map__find_symbol_by_name(struct map *map, const char *name, struct map *map__clone(struct map *map) { - struct map *clone = malloc(sizeof(*clone)); - - if (clone != NULL) - memcpy(clone, map, sizeof(*clone)); - - return clone; + return memdup(map, sizeof(*map)); } int map__overlap(struct map *l, struct map *r)