]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/cuviddec: check for av_buffer_ref() failure
authorJames Almer <jamrial@gmail.com>
Sun, 13 Dec 2020 17:57:19 +0000 (14:57 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 13 Dec 2020 18:50:42 +0000 (15:50 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/cuviddec.c

index 61d7f36c7928dd7445d4d9bee65a792bcd6c460c..331851231fa17bb821da804e3ecc2078476ea582 100644 (file)
@@ -553,6 +553,12 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame)
 
             tmp_frame->format        = AV_PIX_FMT_CUDA;
             tmp_frame->hw_frames_ctx = av_buffer_ref(ctx->hwframe);
+            if (!tmp_frame->hw_frames_ctx) {
+                ret = AVERROR(ENOMEM);
+                av_frame_free(&tmp_frame);
+                goto error;
+            }
+
             tmp_frame->width         = avctx->width;
             tmp_frame->height        = avctx->height;