diff mbox series

[FFmpeg-devel,1/2] avformat/movenc: Check av_malloc()

Message ID AS8P250MB07443957BF54D2CA3BA0E7408F182@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 601873263e618e2dc2b615ae95e605575171ee30
Headers show
Series [FFmpeg-devel,1/2] avformat/movenc: Check av_malloc() | expand

Commit Message

Andreas Rheinhardt May 2, 2024, 9:34 p.m. UTC
Fixes Coverity issue #1596735.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/movenc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer May 3, 2024, 11:16 p.m. UTC | #1
On Thu, May 02, 2024 at 11:34:15PM +0200, Andreas Rheinhardt wrote:
> Fixes Coverity issue #1596735.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/movenc.c | 2 ++
>  1 file changed, 2 insertions(+)

LGTM

thx

[...]
diff mbox series

Patch

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) {