Message ID | 20201213185104.6352-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | eadf7e3a59e89a8e26b28608a9617736b334ce85 |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/cuviddec: check for av_buffer_ref() failure | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
On Sun, 13 Dec 2020 15:51:03 -0300 James Almer <jamrial@gmail.com> wrote: > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/cuviddec.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > 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; > LGTM --phil
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;
Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/cuviddec.c | 6 ++++++ 1 file changed, 6 insertions(+)