Commit 324067d1 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '7ebb3022'

* commit '7ebb3022':
  swscale: Check memory allocation
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 0346783c 7ebb3022
......@@ -1608,17 +1608,13 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
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 (!filter->lumH || !filter->lumV || !filter->chrH || !filter->chrV)
goto fail;
if (chromaSharpen != 0.0) {
SwsVector *id = sws_getIdentityVec();
if (!id)
goto fail;
sws_scaleVec(filter->chrH, -chromaSharpen);
sws_scaleVec(filter->chrV, -chromaSharpen);
sws_addVec(filter->chrH, id);
......@@ -1628,6 +1624,8 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
if (lumaSharpen != 0.0) {
SwsVector *id = sws_getIdentityVec();
if (!id)
goto fail;
sws_scaleVec(filter->lumH, -lumaSharpen);
sws_scaleVec(filter->lumV, -lumaSharpen);
sws_addVec(filter->lumH, id);
......@@ -1652,6 +1650,14 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
sws_printVec2(filter->lumH, NULL, AV_LOG_DEBUG);
return filter;
fail:
sws_freeVec(filter->lumH);
sws_freeVec(filter->lumV);
sws_freeVec(filter->chrH);
sws_freeVec(filter->chrV);
av_freep(&filter);
return NULL;
}
SwsVector *sws_allocVec(int length)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment