[FFmpeg-cvslog] avformat/movenc: Check av_malloc()

Andreas Rheinhardt git at videolan.org
Sat May 4 18:04:32 EEST 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu May  2 23:23:17 2024 +0200| [601873263e618e2dc2b615ae95e605575171ee30] | committer: Andreas Rheinhardt

avformat/movenc: Check av_malloc()

Fixes Coverity issue #1596735.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=601873263e618e2dc2b615ae95e605575171ee30
---

 libavformat/movenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e9bbfd67cf..b4c1db2774 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1221,6 +1221,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) {



More information about the ffmpeg-cvslog mailing list