]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf map: Use zalloc for map_groups
authorJohn Keeping <john@metanate.com>
Thu, 15 Aug 2019 10:01:44 +0000 (11:01 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 16 Aug 2019 15:25:23 +0000 (12:25 -0300)
In the next commit we will add new fields to map_groups and we need
these to be null if no value is assigned.  The simplest way to achieve
this is to request zeroed memory from the allocator.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: john keeping <john@metanate.com>
Link: http://lkml.kernel.org/r/20190815100146.28842-1-john@metanate.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/map.c

index 668410b1d426ffc4cbc2b487e33e1c6a40f8fc9e..44b556812e4b341869fba7209f86cf6149381b9d 100644 (file)
@@ -636,7 +636,7 @@ bool map_groups__empty(struct map_groups *mg)
 
 struct map_groups *map_groups__new(struct machine *machine)
 {
-       struct map_groups *mg = malloc(sizeof(*mg));
+       struct map_groups *mg = zalloc(sizeof(*mg));
 
        if (mg != NULL)
                map_groups__init(mg, machine);