avformat/sierravmd: check for memory allocation failures
authorPaul B Mahol <onemda@gmail.com>
Wed, 11 Sep 2013 09:59:40 +0000 (09:59 +0000)
committerPaul B Mahol <onemda@gmail.com>
Wed, 11 Sep 2013 11:06:44 +0000 (11:06 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/sierravmd.c

index b2d1e5d..059945d 100644 (file)
@@ -126,8 +126,10 @@ static int vmd_read_header(AVFormatContext *s)
             vst->codec->width >>= 1;
             vst->codec->height >>= 1;
         }
-        vst->codec->extradata_size = VMD_HEADER_SIZE;
         vst->codec->extradata = av_mallocz(VMD_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
+        if (!vst->codec->extradata)
+            return AVERROR(ENOMEM);
+        vst->codec->extradata_size = VMD_HEADER_SIZE;
         memcpy(vst->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE);
     }