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