[FFmpeg-devel] [PATCH 01/17] avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Sep 18 23:15:23 EEST 2022


Otherwise, there might be leaks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/avcodec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 29643199be..a165cdea95 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -235,6 +235,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
     if ((avctx->channels > 0 && avctx->ch_layout.nb_channels != avctx->channels) ||
         (avctx->channel_layout && (avctx->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
                                    avctx->ch_layout.u.mask != avctx->channel_layout))) {
+        av_channel_layout_uninit(&avctx->ch_layout);
         if (avctx->channel_layout) {
             av_channel_layout_from_mask(&avctx->ch_layout, avctx->channel_layout);
         } else {
-- 
2.34.1



More information about the ffmpeg-devel mailing list