From: Hui Su Date: Wed, 13 Jan 2021 18:51:39 +0000 (-0800) Subject: vpxenc: initalize the image object X-Git-Tag: v1.10.0-rc1~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=576e0801f9281fd54e2c69ad5be5fef7af656011;p=libvpx vpxenc: initalize the image object Otherwise it would cause problem when calling vpx_img_free() at the end if no frame is read. Change-Id: Ide0ed28eeb142d65d04703442cc4f098ac8edb34 --- diff --git a/vpxenc.c b/vpxenc.c index 5d7546eb2..5042e688c 100644 --- a/vpxenc.c +++ b/vpxenc.c @@ -1636,6 +1636,7 @@ int main(int argc, const char **argv_) { int res = 0; memset(&input, 0, sizeof(input)); + memset(&raw, 0, sizeof(raw)); exec_name = argv_[0]; /* Setup default input stream settings */ @@ -1781,14 +1782,10 @@ int main(int argc, const char **argv_) { FOREACH_STREAM(show_stream_config(stream, &global, &input)); if (pass == (global.pass ? global.pass - 1 : 0)) { - if (input.file_type == FILE_TYPE_Y4M) - /*The Y4M reader does its own allocation. - Just initialize this here to avoid problems if we never read any - frames.*/ - memset(&raw, 0, sizeof(raw)); - else + // The Y4M reader does its own allocation. + if (input.file_type != FILE_TYPE_Y4M) { vpx_img_alloc(&raw, input.fmt, input.width, input.height, 32); - + } FOREACH_STREAM(stream->rate_hist = init_rate_histogram( &stream->config.cfg, &global.framerate)); }