matroskaenc: Check that tracks was allocated
authorDavid Conrad <lessen42@gmail.com>
Fri, 4 Jun 2010 22:41:06 +0000 (22:41 +0000)
committerDavid Conrad <lessen42@gmail.com>
Fri, 4 Jun 2010 22:41:06 +0000 (22:41 +0000)
Originally committed as revision 23477 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/matroskaenc.c

index 6166edf..6bc1005 100644 (file)
@@ -703,6 +703,8 @@ static int mkv_write_header(AVFormatContext *s)
     av_lfg_init(&mkv->lfg, av_get_random_seed());
 
     mkv->tracks = av_mallocz(s->nb_streams * sizeof(*mkv->tracks));
+    if (!mkv->tracks)
+        return AVERROR(ENOMEM);
 
     ebml_header = start_ebml_master(pb, EBML_ID_HEADER, 0);
     put_ebml_uint   (pb, EBML_ID_EBMLVERSION        ,           1);