diff --git a/libavformat/movenc.c b/libavformat/movenc.c index e40948edb8..e6a815107b 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1222,6 +1222,8 @@ static int mov_write_chnl_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra if (ret || !config) { config = 0; speaker_pos = av_malloc(layout->nb_channels); + if (!speaker_pos) + return AVERROR(ENOMEM); ret = ff_mov_get_channel_positions_from_layout(layout, speaker_pos, layout->nb_channels); if (ret) {