1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-07-11 14:30:22 +02:00

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@gmail.com>
This commit is contained in:
James Almer
2025-01-01 19:39:34 -03:00
parent f7900a5609
commit 041a6c3614

View File

@ -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);