diff mbox series

[FFmpeg-devel,26/40] avcodec/avrndec: Check allocation for success

Message ID 20200914052747.124118-10-andreas.rheinhardt@gmail.com
State Accepted
Commit d8e4d26de6a96ffd7813aad5bb0680b494192031
Headers show
Series [FFmpeg-devel,01/16] avcodec/snowdec: Use ff_snow_common_init() directly | expand

Checks

Context Check Description
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 14, 2020, 5:27 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/avrndec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paul B Mahol Sept. 14, 2020, 4:29 p.m. UTC | #1
On Mon, Sep 14, 2020 at 07:27:33AM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/avrndec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
lgtm
> diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
> index f4ec490de5..a4b6fadfc8 100644
> --- a/libavcodec/avrndec.c
> +++ b/libavcodec/avrndec.c
> @@ -54,6 +54,8 @@ static av_cold int init(AVCodecContext *avctx)
>          }
>  
>          a->mjpeg_avctx = avcodec_alloc_context3(codec);
> +        if (!a->mjpeg_avctx)
> +            return AVERROR(ENOMEM);
>  
>          av_dict_set(&thread_opt, "threads", "1", 0); // Is this needed ?
>          a->mjpeg_avctx->refcounted_frames = 1;
> -- 
> 2.25.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index f4ec490de5..a4b6fadfc8 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -54,6 +54,8 @@  static av_cold int init(AVCodecContext *avctx)
         }
 
         a->mjpeg_avctx = avcodec_alloc_context3(codec);
+        if (!a->mjpeg_avctx)
+            return AVERROR(ENOMEM);
 
         av_dict_set(&thread_opt, "threads", "1", 0); // Is this needed ?
         a->mjpeg_avctx->refcounted_frames = 1;