aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-05-10 09:56:50 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-10 09:57:39 -0400
commitcdd5b75b0cd24c4d6a98b12a219217b1ccfe2586 (patch)
tree540a54641d6d236b6159c4e3721000dcf403ba15 /tools/perf
parent7f8264539c62378cccbdf9b598927b034bef4a92 (diff)
perf callchains: Use zalloc to allocate objects
Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/callchain.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index ac148613afe8..21a52e0a4435 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -167,7 +167,7 @@ create_child(struct callchain_node *parent, bool inherit_children)
167{ 167{
168 struct callchain_node *new; 168 struct callchain_node *new;
169 169
170 new = malloc(sizeof(*new)); 170 new = zalloc(sizeof(*new));
171 if (!new) { 171 if (!new) {
172 perror("not enough memory to create child for code path tree"); 172 perror("not enough memory to create child for code path tree");
173 return NULL; 173 return NULL;
@@ -213,7 +213,7 @@ fill_node(struct callchain_node *node, struct resolved_chain *chain, int start)
213 for (i = start; i < chain->nr; i++) { 213 for (i = start; i < chain->nr; i++) {
214 struct callchain_list *call; 214 struct callchain_list *call;
215 215
216 call = malloc(sizeof(*call)); 216 call = zalloc(sizeof(*call));
217 if (!call) { 217 if (!call) {
218 perror("not enough memory for the code path tree"); 218 perror("not enough memory for the code path tree");
219 return; 219 return;
@@ -386,7 +386,7 @@ int append_chain(struct callchain_node *root, struct ip_callchain *chain,
386 if (!chain->nr) 386 if (!chain->nr)
387 return 0; 387 return 0;
388 388
389 filtered = malloc(sizeof(*filtered) + 389 filtered = zalloc(sizeof(*filtered) +
390 chain->nr * sizeof(struct resolved_ip)); 390 chain->nr * sizeof(struct resolved_ip));
391 if (!filtered) 391 if (!filtered)
392 return -ENOMEM; 392 return -ENOMEM;