ref: 296d1dc006419546f342606ff7d47564bd9798a8
parent: cacc8e350c4066ff1bb3ffb2cbf9813bd26d7baa
author: Luc Trudeau <ltrudeau@twoorioles.com>
date: Fri Feb 21 05:23:22 EST 2020
cli: Replace malloc + memset(0) with calloc in input.c
--- a/tools/input/input.c
+++ b/tools/input/input.c
@@ -105,11 +105,10 @@
}
}
- if (!(c = malloc(sizeof(DemuxerContext) + impl->priv_data_size))) {
+ if (!(c = calloc(1, sizeof(DemuxerContext) + impl->priv_data_size))) {
fprintf(stderr, "Failed to allocate memory\n");
return DAV1D_ERR(ENOMEM);
}
- memset(c, 0, sizeof(DemuxerContext) + impl->priv_data_size);
c->impl = impl;
c->data = (DemuxerPriv *) &c[1];
if ((res = impl->open(c->data, filename, fps, num_frames, timebase)) < 0) {
--- a/tools/input/ivf.c
+++ b/tools/input/ivf.c
@@ -63,7 +63,6 @@
size_t res;
uint8_t hdr[32];
- memset(c, 0, sizeof(*c));
if (!(c->f = fopen(file, "rb"))) {
fprintf(stderr, "Failed to open %s: %s\n", file, strerror(errno));
return -1;