diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-22 03:40:17 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-22 03:40:37 +0100 |
commit | 324067d18bf23993855c4fc59f947488e9854ed7 (patch) | |
tree | 4de25a0dc7c3fe3216430a0a99e91d9581e4d61f /libswscale | |
parent | 0346783c9886f7d86a12ad9ed20d768a308f5da2 (diff) | |
parent | 7ebb3022297aa00afda6800105684b8303f2608e (diff) | |
download | ffmpeg-streaming-324067d18bf23993855c4fc59f947488e9854ed7.zip ffmpeg-streaming-324067d18bf23993855c4fc59f947488e9854ed7.tar.gz |
Merge commit '7ebb3022297aa00afda6800105684b8303f2608e'
* commit '7ebb3022297aa00afda6800105684b8303f2608e':
swscale: Check memory allocation
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/utils.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index fd0247d..7810719 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -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) |