westwood_vqa: check return value of av_malloc()
authorPaul B Mahol <onemda@gmail.com>
Mon, 1 Jul 2013 22:15:25 +0000 (22:15 +0000)
committerPaul B Mahol <onemda@gmail.com>
Mon, 1 Jul 2013 22:15:25 +0000 (22:15 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/westwood_vqa.c

index c996dad8a256ff28468b43fbb81ab4a3063d1033..00e95cd67abaa265b8a6b4883879dad4eeceaa72 100644 (file)
@@ -101,8 +101,10 @@ static int wsvqa_read_header(AVFormatContext *s)
     avio_seek(pb, 20, SEEK_SET);
 
     /* the VQA header needs to go to the decoder */
-    st->codec->extradata_size = VQA_HEADER_SIZE;
     st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
+    if (!st->codec->extradata)
+        return AVERROR(ENOMEM);
+    st->codec->extradata_size = VQA_HEADER_SIZE;
     header = (unsigned char *)st->codec->extradata;
     if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
         VQA_HEADER_SIZE) {