summaryrefslogtreecommitdiff
path: root/libavcodec/cuviddec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-12-13 14:57:19 -0300
committerJames Almer <jamrial@gmail.com>2020-12-13 15:50:42 -0300
commiteadf7e3a59e89a8e26b28608a9617736b334ce85 (patch)
tree8216291b23622f76af267127a227cd2a38911618 /libavcodec/cuviddec.c
parent081a17990b9a8661ac2d1498937d3b35d26d8912 (diff)
downloadffmpeg-eadf7e3a59e89a8e26b28608a9617736b334ce85.tar.gz
avcodec/cuviddec: check for av_buffer_ref() failure
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cuviddec.c')
-rw-r--r--libavcodec/cuviddec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 61d7f36c79..331851231f 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -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;