[FFmpeg-devel] [PATCH 33/45] avcodec/smvjpegdec: Check allocation for success

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Nov 27 03:02:37 EET 2020


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/smvjpegdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index 587ad82a00..32756b54f3 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -120,6 +120,10 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx)
     }
 
     s->avctx = avcodec_alloc_context3(codec);
+    if (!s->avctx) {
+        smvjpeg_decode_end(avctx);
+        return AVERROR(ENOMEM);
+    }
 
     av_dict_set(&thread_opt, "threads", "1", 0);
     s->avctx->refcounted_frames = 1;
-- 
2.25.1



More information about the ffmpeg-devel mailing list