[FFmpeg-cvslog] avfilter/overlay_cuda: check av_buffer_ref result

Timo Rothenpieler git at videolan.org
Sun Apr 11 11:22:15 EEST 2021


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sun Apr 11 10:15:47 2021 +0200| [ef16dcc6a9240644d8e06528c19710783b7c6adf] | committer: Timo Rothenpieler

avfilter/overlay_cuda: check av_buffer_ref result

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef16dcc6a9240644d8e06528c19710783b7c6adf
---

 libavfilter/vf_overlay_cuda.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index e45f510644..34241c8e1b 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -346,6 +346,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
     // initialize
 
     ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
+    if (!ctx->hw_device_ctx)
+        return AVERROR(ENOMEM);
     ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
 
     cuda_ctx = ctx->hwctx->cuda_ctx;
@@ -354,6 +356,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
     ctx->cu_stream = ctx->hwctx->stream;
 
     outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
+    if (!outlink->hw_frames_ctx)
+        return AVERROR(ENOMEM);
 
     // load functions
 



More information about the ffmpeg-cvslog mailing list