mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-18 02:46:06 +00:00
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>
This commit is contained in:
parent
7f8264539c
commit
cdd5b75b0c
@ -167,7 +167,7 @@ create_child(struct callchain_node *parent, bool inherit_children)
|
|||||||
{
|
{
|
||||||
struct callchain_node *new;
|
struct callchain_node *new;
|
||||||
|
|
||||||
new = malloc(sizeof(*new));
|
new = zalloc(sizeof(*new));
|
||||||
if (!new) {
|
if (!new) {
|
||||||
perror("not enough memory to create child for code path tree");
|
perror("not enough memory to create child for code path tree");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -213,7 +213,7 @@ fill_node(struct callchain_node *node, struct resolved_chain *chain, int start)
|
|||||||
for (i = start; i < chain->nr; i++) {
|
for (i = start; i < chain->nr; i++) {
|
||||||
struct callchain_list *call;
|
struct callchain_list *call;
|
||||||
|
|
||||||
call = malloc(sizeof(*call));
|
call = zalloc(sizeof(*call));
|
||||||
if (!call) {
|
if (!call) {
|
||||||
perror("not enough memory for the code path tree");
|
perror("not enough memory for the code path tree");
|
||||||
return;
|
return;
|
||||||
@ -386,7 +386,7 @@ int append_chain(struct callchain_node *root, struct ip_callchain *chain,
|
|||||||
if (!chain->nr)
|
if (!chain->nr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
filtered = malloc(sizeof(*filtered) +
|
filtered = zalloc(sizeof(*filtered) +
|
||||||
chain->nr * sizeof(struct resolved_ip));
|
chain->nr * sizeof(struct resolved_ip));
|
||||||
if (!filtered)
|
if (!filtered)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user