[FFmpeg-cvslog] avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it

Andreas Rheinhardt git at videolan.org
Thu Sep 22 02:39:54 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Sep 18 21:33:27 2022 +0200| [e2e31815191254ef5581213639f4bed8e4a8be25] | committer: Andreas Rheinhardt

avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it

Otherwise, there might be leaks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2e31815191254ef5581213639f4bed8e4a8be25
---

 libavcodec/avcodec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 1f8ab37abb..81f30a4a58 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 {



More information about the ffmpeg-cvslog mailing list