ffmpeg | branch: release/7.1 | Marvin Scholz <epira...@gmail.com> | Thu Sep 12 04:58:38 2024 +0200| [ebd0ca9fee85891262979b2c9d320ff69abdc104] | committer: Marton Balint
avdevice/decklink_dec: fix leaks on error In case of errors in this function, the allocated context was not properly freed in several cases. Signed-off-by: Marton Balint <c...@passwd.hu> (cherry picked from commit 8e76c993013d6dd9382774d1716d8fe2421c42bd) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebd0ca9fee85891262979b2c9d320ff69abdc104 --- libavdevice/decklink_dec.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 9a817daf18..418701e4e0 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -1114,7 +1114,8 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) break; default: av_log(avctx, AV_LOG_ERROR, "Value of channels option must be one of 2, 8 or 16\n"); - return AVERROR(EINVAL); + ret = AVERROR(EINVAL); + goto error; } /* Check audio bit depth option for valid values: 16 or 32 */ @@ -1124,18 +1125,20 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) break; default: av_log(avctx, AV_LOG_ERROR, "Value for audio bit depth option must be either 16 or 32\n"); - return AVERROR(EINVAL); + ret = AVERROR(EINVAL); + goto error; } /* List available devices. */ if (ctx->list_devices) { ff_decklink_list_devices_legacy(avctx, 1, 0); - return AVERROR_EXIT; + ret = AVERROR_EXIT; + goto error; } ret = ff_decklink_init_device(avctx, avctx->url); if (ret < 0) - return ret; + goto error; /* Get input device. */ if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { @@ -1336,6 +1339,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) error: ff_decklink_cleanup(avctx); + av_freep(&cctx->ctx); return ret; } _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".