And ensure the last element is the zeroed terminator. Fixes ticket #11392.
Unified · Split
| @@ -205,8 +205,9 @@ static av_cold int common_init(AVFilterContext *ctx) · 204 unmodified lines | ||
| 205 | 205 | if (!tmp) |
| 206 | 206 | return AVERROR(ENOMEM); |
| 207 | 207 | |
| 208 | + buf->channel_layouts = tmp; | |
| 208 | 209 | memset(&buf->channel_layouts[buf->nb_channel_layouts], 0, |
| 209 | − sizeof(*buf->channel_layouts)); | |
| 210 | + sizeof(*buf->channel_layouts) * 2); | |
| 210 | 211 | buf->nb_channel_layouts++; |
| 211 | 212 | |
| 212 | 213 | ret = av_channel_layout_from_string(&buf->channel_layouts[buf->nb_channel_layouts - 1], cur); |