avfilter/overlay_cuda: check av_buffer_ref result release/4.3
authorTimo Rothenpieler <timo@rothenpieler.org>
Sun, 11 Apr 2021 08:15:47 +0000 (10:15 +0200)
committerTimo Rothenpieler <timo@rothenpieler.org>
Sun, 11 Apr 2021 08:26:51 +0000 (10:26 +0200)
libavfilter/vf_overlay_cuda.c

index e45f510644ffea079f8f43148873e87a14235279..34241c8e1b5c336e9f504555f4be4d383b049efc 100644 (file)
@@ -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