aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2021-04-11 10:15:47 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2021-04-11 10:22:57 +0200
commitacb339bb88ca1a52ef4edb3a5f3df24ed05be82d (patch)
tree9d6d0d47cfafee8490729e8690aa2f71cc0d46c4
parent5873e06460856a8cb5da25a4f72e86e1d861c586 (diff)
downloadffmpeg-acb339bb88ca1a52ef4edb3a5f3df24ed05be82d.tar.gz
avfilter/overlay_cuda: check av_buffer_ref result
-rw-r--r--libavfilter/vf_overlay_cuda.c4
1 files changed, 4 insertions, 0 deletions
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