summaryrefslogtreecommitdiff
path: root/src/bootchart/log.c
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2013-01-10 11:35:00 -0800
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-01-10 15:21:48 -0500
commita2e9b3380804c9eff565836b0e32b88389d4391c (patch)
treecf9de3c53121b03354c3d7cd9e006b14d654ad96 /src/bootchart/log.c
parent53f5329f7aa321d72847cd7f8f28da9a7db80331 (diff)
bootchart: Convert malloc/memset to calloc
Diffstat (limited to 'src/bootchart/log.c')
-rw-r--r--src/bootchart/log.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/bootchart/log.c b/src/bootchart/log.c
index c697121814..e41689d611 100644
--- a/src/bootchart/log.c
+++ b/src/bootchart/log.c
@@ -225,21 +225,19 @@ schedstat_next:
char t[32];
struct ps_struct *parent;
- ps->next_ps = malloc(sizeof(struct ps_struct));
+ ps->next_ps = calloc(1, sizeof(struct ps_struct));
if (!ps->next_ps) {
- perror("malloc(ps_struct)");
+ perror("calloc(ps_struct)");
exit (EXIT_FAILURE);
}
- memset(ps->next_ps, 0, sizeof(struct ps_struct));
ps = ps->next_ps;
ps->pid = pid;
- ps->sample = malloc(sizeof(struct ps_sched_struct) * (len + 1));
+ ps->sample = calloc(len + 1, sizeof(struct ps_sched_struct));
if (!ps->sample) {
- perror("malloc(ps_struct)");
+ perror("calloc(ps_struct)");
exit (EXIT_FAILURE);
}
- memset(ps->sample, 0, sizeof(struct ps_sched_struct) * (len + 1));
pscount++;