[FFmpeg-cvslog] avformat/avidec: use av_calloc() and check for allocation error

Paul B Mahol git at videolan.org
Mon Sep 16 22:02:10 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Sep 16 17:22:28 2013 +0000| [c051d668b5dbf040f92551f78b1b13635b8fcfb8] | committer: Paul B Mahol

avformat/avidec: use av_calloc() and check for allocation error

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavformat/avidec.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index fab1168..ff20b7c 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1487,7 +1487,9 @@ static int guess_ni_flag(AVFormatContext *s)
     avio_seek(s->pb, oldpos, SEEK_SET);
     if (last_start > first_end)
         return 1;
-    idx= av_mallocz(sizeof(*idx) * s->nb_streams);
+    idx= av_calloc(s->nb_streams, sizeof(*idx));
+    if (!idx)
+        return 0;
     for (min_pos=pos=0; min_pos!=INT64_MAX; pos= min_pos+1LU) {
         int64_t max_dts = INT64_MIN/2, min_dts= INT64_MAX/2;
         min_pos = INT64_MAX;



More information about the ffmpeg-cvslog mailing list