aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authorFederico Tomassetti <federico@tomassetti.me>2015-03-21 10:45:01 +0000
committerLuca Barbato <lu_zero@gentoo.org>2015-03-21 23:18:11 +0100
commit7ebb3022297aa00afda6800105684b8303f2608e (patch)
tree0e0d3e9072bbcdf905de3ea4d59def49130e3c7e /libswscale
parentc28ed1d743443e783537d279ae721be3bbdf7646 (diff)
downloadffmpeg-7ebb3022297aa00afda6800105684b8303f2608e.tar.gz
swscale: Check memory allocation
Bug-Id: CID 1267890 CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/utils.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 23d7c93232..f5b251136a 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1382,17 +1382,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);
@@ -1402,6 +1398,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);
@@ -1426,6 +1424,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)