diff --git a/m1/perf/sched.c b/m1/perf/sched.c index ffe57c9..e7cc6db 100644 --- a/m1/perf/sched.c +++ b/m1/perf/sched.c @@ -315,14 +315,12 @@ static void mark(int vm_reg) static void init_registers(struct fpvm_fragment *frag, unsigned int *registers) { - size_t regs_size; int i; get_registers(frag, registers); - regs_size = sizeof(struct vm_reg)*(frag->nbindings-frag->next_sur); - sc->regs = malloc(regs_size); - memset(sc->regs, 0, regs_size); + sc->regs = + calloc(frag->nbindings-frag->next_sur, sizeof(struct vm_reg)); for (i = 0; i != frag->ninstructions; i++) { mark(frag->code[i].opa); @@ -614,8 +612,7 @@ static int schedule(unsigned int *code) static void init_scheduler_context(struct fpvm_fragment *frag, unsigned int *reg) { - sc = malloc(sizeof(*sc)); - memset(sc, 0, sizeof(*sc)); + sc = calloc(1, sizeof(*sc)); sc->frag = frag;