swscale: Check memory allocations
authorFederico Tomassetti <f.tomassetti@gmail.com>
Sun, 15 Feb 2015 19:44:51 +0000 (19:44 +0000)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Tue, 17 Feb 2015 17:16:43 +0000 (12:16 -0500)
CC: libav-stable@libav.org
Bug-Id: CID 1267888 / CID 1267890
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libswscale/utils.c

index b3df1af..23d7c93 100644 (file)
@@ -1382,6 +1382,15 @@ 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 (chromaSharpen != 0.0) {
         SwsVector *id = sws_getIdentityVec();
         sws_scaleVec(filter->chrH, -chromaSharpen);