[FFmpeg-devel] [PATCH 1/2] avdevice/decklink_dec: fix leak on error

Marvin Scholz epirat07 at gmail.com
Thu Sep 12 05:52:43 EEST 2024


In the early return when both draw_bars and signal_loss_action
options are used, the context allocated previously was not
properly freed.

Introduced in 9bcb86b0fa58f1a5a2a8613065349e26abadb329

Fixes CID1619296
---
 libavdevice/decklink_dec.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 54d698bc12a..9a817daf187 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -1096,10 +1096,11 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
         ctx->signal_loss_action = SIGNAL_LOSS_NONE;
         av_log(avctx, AV_LOG_WARNING, "Setting signal_loss_action to none because draw_bars is false\n");
     }
     if (!ctx->draw_bars && ctx->signal_loss_action != SIGNAL_LOSS_NONE) {
         av_log(avctx, AV_LOG_ERROR, "options draw_bars and signal_loss_action are mutually exclusive\n");
+        av_freep(&ctx);
         return AVERROR(EINVAL);
     }
     ctx->audio_depth = cctx->audio_depth;
     if (cctx->raw_format > 0 && (unsigned int)cctx->raw_format < FF_ARRAY_ELEMS(decklink_raw_format_map))
         ctx->raw_format = decklink_raw_format_map[cctx->raw_format];

base-commit: 2e91532ead860651c135bdedd96b6112ff715529
-- 
2.46.0




More information about the ffmpeg-devel mailing list