]> git.sesse.net Git - ffmpeg/commitdiff
avformat/avidec: use av_calloc() and check for allocation error
authorPaul B Mahol <onemda@gmail.com>
Mon, 16 Sep 2013 17:22:28 +0000 (17:22 +0000)
committerPaul B Mahol <onemda@gmail.com>
Mon, 16 Sep 2013 18:53:28 +0000 (18:53 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/avidec.c

index fab1168c2282d0f0395e0bc67afbb7503f508147..ff20b7c0d82d21eeee70eaf62f3c8eb722be1008 100644 (file)
@@ -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;