changeset 29501:a0ba51e33912

Check return values of sws_allocVec() and sws_getConstVec().
author ramiro
date Thu, 20 Aug 2009 01:55:45 +0000
parents 60819382adfe
children 9fa45a007afe
files libswscale/swscale.c
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Wed Aug 19 16:03:05 2009 +0000
+++ b/libswscale/swscale.c	Thu Aug 20 01:55:45 2009 +0000
@@ -3259,6 +3259,9 @@
     double middle= (length-1)*0.5;
     SwsVector *vec= sws_allocVec(length);
 
+    if (!vec)
+        return NULL;
+
     for (i=0; i<length; i++) {
         double dist= i-middle;
         vec->coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*PI);
@@ -3274,6 +3277,9 @@
     int i;
     SwsVector *vec= sws_allocVec(length);
 
+    if (!vec)
+        return NULL;
+
     for (i=0; i<length; i++)
         vec->coeff[i]= c;
 
@@ -3316,6 +3322,9 @@
     int i, j;
     SwsVector *vec= sws_getConstVec(0.0, length);
 
+    if (!vec)
+        return NULL;
+
     for (i=0; i<a->length; i++) {
         for (j=0; j<b->length; j++) {
             vec->coeff[i+j]+= a->coeff[i]*b->coeff[j];
@@ -3331,6 +3340,9 @@
     int i;
     SwsVector *vec= sws_getConstVec(0.0, length);
 
+    if (!vec)
+        return NULL;
+
     for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
     for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]+= b->coeff[i];
 
@@ -3343,6 +3355,9 @@
     int i;
     SwsVector *vec= sws_getConstVec(0.0, length);
 
+    if (!vec)
+        return NULL;
+
     for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
     for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]-= b->coeff[i];
 
@@ -3356,6 +3371,9 @@
     int i;
     SwsVector *vec= sws_getConstVec(0.0, length);
 
+    if (!vec)
+        return NULL;
+
     for (i=0; i<a->length; i++) {
         vec->coeff[i + (length-1)/2 - (a->length-1)/2 - shift]= a->coeff[i];
     }
@@ -3404,6 +3422,9 @@
     int i;
     SwsVector *vec= sws_allocVec(a->length);
 
+    if (!vec)
+        return NULL;
+
     for (i=0; i<a->length; i++) vec->coeff[i]= a->coeff[i];
 
     return vec;