avformat/sierravmd: check for memory allocation failures

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2013-09-11 09:59:40 +00:00
parent 00e1bf8a58
commit 60caa3d8bc
1 changed files with 3 additions and 1 deletions

View 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);
}