segafilm: Check for memory allocation failures in segafilm demuxer.
authorLaurent Aimar <fenrir@elivagar.org>
Thu, 6 Oct 2011 20:53:41 +0000 (22:53 +0200)
committerJanne Grunau <janne-libav@jannau.net>
Thu, 6 Oct 2011 21:19:45 +0000 (23:19 +0200)
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
libavformat/segafilm.c

index ea464f2..4bbacc5 100644 (file)
@@ -257,6 +257,10 @@ static int film_read_packet(AVFormatContext *s,
             av_free(film->stereo_buffer);
             film->stereo_buffer_size = sample->sample_size;
             film->stereo_buffer = av_malloc(film->stereo_buffer_size);
+            if (!film->stereo_buffer) {
+                film->stereo_buffer_size = 0;
+                return AVERROR(ENOMEM);
+            }
         }
 
         pkt->pos= avio_tell(pb);