diff mbox series

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

Message ID 20201127010249.2724610-33-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/45] avcodec/a64multienc: Fix memleak upon init failure
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 27, 2020, 1:02 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/smvjpegdec.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

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;