[FFmpeg-cvslog] avcodec/codec_par: do not copy AVChannelLayout struct directly

Marton Balint git at videolan.org
Tue Mar 15 17:28:30 EET 2022


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Tue Mar 15 15:21:14 2022 +0100| [ef2b3efd5153568989324f01de41ca19bf3afda1] | committer: Marton Balint

avcodec/codec_par: do not copy AVChannelLayout struct directly

Later we use av_channel_layout_copy, but that uninits the struct
unintentionally freeing the possibly allocated u.map pointer.

Signed-off-by: Marton Balint <cus at passwd.hu>

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

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

diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
index e4b329c838..abda649aa8 100644
--- a/libavcodec/codec_par.c
+++ b/libavcodec/codec_par.c
@@ -78,6 +78,7 @@ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src
     codec_parameters_reset(dst);
     memcpy(dst, src, sizeof(*dst));
 
+    dst->ch_layout      = (AVChannelLayout){0};
     dst->extradata      = NULL;
     dst->extradata_size = 0;
     if (src->extradata) {



More information about the ffmpeg-cvslog mailing list