diff mbox series

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

Message ID D43YWTLYCFW3.2DS6MENOU4907@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avdevice/decklink_dec: fix leak on error | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz Sept. 12, 2024, 2:52 a.m. UTC
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(+)


base-commit: 2e91532ead860651c135bdedd96b6112ff715529
diff mbox series

Patch

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];