avcodec/cuviddec: check for av_buffer_ref() failure

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-12-13 14:57:19 -03:00
parent 081a17990b
commit eadf7e3a59
1 changed files with 6 additions and 0 deletions

View 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;