ref: 0c88560789b4388cc1d2113110574040606a0b45
parent: bf56afde17cdf40303f8d3ec5bca549bc57866c5
author: Luc Trudeau <ltrudeau@twoorioles.com>
date: Thu Feb 20 16:01:43 EST 2020
Replace malloc+memset(0) with calloc
--- a/src/lib.c
+++ b/src/lib.c
@@ -148,10 +148,8 @@
memset(c->fc, 0, sizeof(*c->fc) * s->n_frame_threads);
if (c->n_fc > 1) {
c->frame_thread.out_delayed =
- malloc(sizeof(*c->frame_thread.out_delayed) * c->n_fc);
+ calloc(c->n_fc, sizeof(*c->frame_thread.out_delayed));
if (!c->frame_thread.out_delayed) goto error;
- memset(c->frame_thread.out_delayed, 0,
- sizeof(*c->frame_thread.out_delayed) * c->n_fc);
}
for (int n = 0; n < s->n_frame_threads; n++) {
Dav1dFrameContext *const f = &c->fc[n];
--- a/src/ref_mvs.c
+++ b/src/ref_mvs.c
@@ -2094,10 +2094,7 @@
AV1_COMMON *dav1d_alloc_ref_mv_common(void);
AV1_COMMON *dav1d_alloc_ref_mv_common(void) {
- AV1_COMMON *cm = malloc(sizeof(*cm));
- if (!cm) return NULL;
- memset(cm, 0, sizeof(*cm));
- return cm;
+ return calloc(1, sizeof(AV1_COMMON));
}
void dav1d_free_ref_mv_common(AV1_COMMON *cm);