vc1test: Check malloc call
authorNidhi Makhijani <nidhimj22@gmail.com>
Sun, 6 Jul 2014 15:22:52 +0000 (20:52 +0530)
committerDiego Biurrun <diego@biurrun.de>
Sun, 6 Jul 2014 16:25:52 +0000 (09:25 -0700)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
libavformat/vc1test.c

index 8fabf7d..f302c2b 100644 (file)
@@ -62,6 +62,8 @@ static int vc1t_read_header(AVFormatContext *s)
     st->codec->codec_id = AV_CODEC_ID_WMV3;
 
     st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
     st->codec->codec_id = AV_CODEC_ID_WMV3;
 
     st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
+    if (!st->codec->extradata)
+        return AVERROR(ENOMEM);
     st->codec->extradata_size = VC1_EXTRADATA_SIZE;
     avio_read(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
     st->codec->height = avio_rl32(pb);
     st->codec->extradata_size = VC1_EXTRADATA_SIZE;
     avio_read(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
     st->codec->height = avio_rl32(pb);