swscale: Check memory allocations

CC: libav-stable@libav.org
Bug-Id: CID 1267888 / CID 1267890
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
Federico Tomassetti 2015-02-15 19:44:51 +00:00 committed by Vittorio Giovara
parent 3035d21b5a
commit e51f22122d

View File

@ -1382,6 +1382,15 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
filter->chrV = sws_getIdentityVec(); filter->chrV = sws_getIdentityVec();
} }
if (!filter->lumH || !filter->lumV || !filter->chrH || !filter->chrV) {
sws_freeVec(filter->lumH);
sws_freeVec(filter->lumV);
sws_freeVec(filter->chrH);
sws_freeVec(filter->chrV);
av_freep(&filter);
return NULL;
}
if (chromaSharpen != 0.0) { if (chromaSharpen != 0.0) {
SwsVector *id = sws_getIdentityVec(); SwsVector *id = sws_getIdentityVec();
sws_scaleVec(filter->chrH, -chromaSharpen); sws_scaleVec(filter->chrH, -chromaSharpen);