[FFmpeg-cvslog] avcodec/mpegvideo: Don't unnecessarily allocate buffers
Andreas Rheinhardt
git at videolan.org
Sun Jan 9 11:31:19 EET 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat Jan 1 12:12:22 2022 +0100| [4fc4cf49315c96531a7675140502df222ae8e942] | committer: Andreas Rheinhardt
avcodec/mpegvideo: Don't unnecessarily allocate buffers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4fc4cf49315c96531a7675140502df222ae8e942
---
libavcodec/mpegvideo.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1c2b28f450..af433153f2 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -371,17 +371,17 @@ static int init_duplicate_context(MpegEncContext *s)
s->pblocks[i] = &s->block[i];
}
- if (!(s->block32 = av_mallocz(sizeof(*s->block32))) ||
- !(s->dpcm_macroblock = av_mallocz(sizeof(*s->dpcm_macroblock))))
- return AVERROR(ENOMEM);
- s->dpcm_direction = 0;
-
if (s->avctx->codec_tag == AV_RL32("VCR2")) {
// exchange uv
FFSWAP(void *, s->pblocks[4], s->pblocks[5]);
}
if (s->out_format == FMT_H263) {
+ if (!(s->block32 = av_mallocz(sizeof(*s->block32))) ||
+ !(s->dpcm_macroblock = av_mallocz(sizeof(*s->dpcm_macroblock))))
+ return AVERROR(ENOMEM);
+ s->dpcm_direction = 0;
+
/* ac values */
if (!FF_ALLOCZ_TYPED_ARRAY(s->ac_val_base, yc_size))
return AVERROR(ENOMEM);
More information about the ffmpeg-cvslog
mailing list