[FFmpeg-cvslog] avformat/iamf_writer: Remove nonsense check

Andreas Rheinhardt git at videolan.org
Tue Feb 20 00:39:05 EET 2024

ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Feb 19 19:13:11 2024 +0100| [840f192540ccf261561cf3ccedf8a8b91421f66b] | committer: Andreas Rheinhardt

avformat/iamf_writer: Remove nonsense check

Checking whether a pointer to an element of an array is NULL
makes no sense, as the pointer addition involved in getting
the address would be undefined behaviour already if the array
were NULL.
In this case the array allocation has already been checked
a few lines before.
Fixes Coverity issue #1559548.

Reviewed-by: James Almer <jamrial at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=840f192540ccf261561cf3ccedf8a8b91421f66b

 libavformat/iamf_writer.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/iamf_writer.c b/libavformat/iamf_writer.c
index 897b06310f..e0c47b5e9d 100644
--- a/libavformat/iamf_writer.c
+++ b/libavformat/iamf_writer.c
@@ -251,8 +251,6 @@ int ff_iamf_add_audio_element(IAMFContext *iamf, const AVStreamGroup *stg, void
         int nb_channels = iamf_audio_element->layers[i]->ch_layout.nb_channels;
         IAMFLayer *layer = &audio_element->layers[i];
-        if (!layer)
-            return AVERROR(ENOMEM);
         memset(layer, 0, sizeof(*layer));
         if (i)

More information about the ffmpeg-cvslog mailing list