[FFmpeg-cvslog] avfilter/buffersink: don't leak the reallocated channel layouts array
James Almer
git at videolan.org
Thu Jan 2 00:44:02 EET 2025
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Jan 1 19:39:34 2025 -0300| [041a6c36142f89addf2bc850f5bd27a089d900f5] | committer: James Almer
avfilter/buffersink: don't leak the reallocated channel layouts array
And ensure the last element is the zeroed terminator.
Fixes ticket #11392.
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=041a6c36142f89addf2bc850f5bd27a089d900f5
---
libavfilter/buffersink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index b0bcc26432..565d084ddf 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -205,8 +205,9 @@ static av_cold int common_init(AVFilterContext *ctx)
if (!tmp)
return AVERROR(ENOMEM);
+ buf->channel_layouts = tmp;
memset(&buf->channel_layouts[buf->nb_channel_layouts], 0,
- sizeof(*buf->channel_layouts));
+ sizeof(*buf->channel_layouts) * 2);
buf->nb_channel_layouts++;
ret = av_channel_layout_from_string(&buf->channel_layouts[buf->nb_channel_layouts - 1], cur);
More information about the ffmpeg-cvslog
mailing list