[FFmpeg-cvslog] avcodec/magicyuvenc: check for allocation return value

Paul B Mahol git at videolan.org
Sun Sep 10 14:48:54 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 10 12:10:12 2023 +0200| [4d1b7ff73337f2a0bfc81e3b36b6f761e752b642] | committer: Paul B Mahol

avcodec/magicyuvenc: check for allocation return value

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d1b7ff73337f2a0bfc81e3b36b6f761e752b642
---

 libavcodec/magicyuvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index d299bc14a0..429efccd24 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -215,7 +215,7 @@ static av_cold int magy_encode_init(AVCodecContext *avctx)
     s->slices = av_calloc(s->nb_slices * s->planes, sizeof(*s->slices));
     s->bitslices = av_calloc(s->nb_slices * s->planes, sizeof(*s->bitslices));
     s->counts = av_calloc(s->nb_slices * s->planes * 256, sizeof(*s->counts));
-    if (!s->slices || !s->slice_pos || !s->counts || !s->slice_size)
+    if (!s->slices || !s->slice_pos || !s->counts || !s->slice_size || !s->bitslices)
         return AVERROR(ENOMEM);
 
     s->bitslice_size = avctx->width * (s->slice_height + 2) + AV_INPUT_BUFFER_PADDING_SIZE;



More information about the ffmpeg-cvslog mailing list