aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c4ca974b36e3..8db85b4f553f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -94,15 +94,14 @@ static void kernel_maps__fixup_end(void)
94static struct symbol *symbol__new(u64 start, u64 len, const char *name) 94static struct symbol *symbol__new(u64 start, u64 len, const char *name)
95{ 95{
96 size_t namelen = strlen(name) + 1; 96 size_t namelen = strlen(name) + 1;
97 struct symbol *self = calloc(1, (symbol__priv_size + 97 struct symbol *self = zalloc(symbol__priv_size +
98 sizeof(*self) + namelen)); 98 sizeof(*self) + namelen);
99 if (!self) 99 if (self == NULL)
100 return NULL; 100 return NULL;
101 101
102 if (symbol__priv_size) { 102 if (symbol__priv_size)
103 memset(self, 0, symbol__priv_size);
104 self = ((void *)self) + symbol__priv_size; 103 self = ((void *)self) + symbol__priv_size;
105 } 104
106 self->start = start; 105 self->start = start;
107 self->end = len ? start + len - 1 : start; 106 self->end = len ? start + len - 1 : start;
108 107