summaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authorramiro <ramiro@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-20 01:55:45 +0000
committerramiro <ramiro@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-20 01:55:45 +0000
commit728be1cb1a67ff0bf1cc53658a11ab9274f5dbee (patch)
tree86258c40e04b1aaaf6133c41f8b49a796dd65700 /libswscale
parent54af60865f145e9c5a1310810a0657216ae24dc1 (diff)
downloadmpv-728be1cb1a67ff0bf1cc53658a11ab9274f5dbee.tar.bz2
mpv-728be1cb1a67ff0bf1cc53658a11ab9274f5dbee.tar.xz
Check return values of sws_allocVec() and sws_getConstVec().
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29543 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/swscale.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 6dfbed7e17..2f5d5f1e5e 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -3259,6 +3259,9 @@ SwsVector *sws_getGaussianVec(double variance, double quality)
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 @@ SwsVector *sws_getConstVec(double c, int length)
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 @@ static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b)
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 @@ static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b)
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 @@ static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b)
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 @@ static SwsVector *sws_getShiftedVec(SwsVector *a, int shift)
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 @@ SwsVector *sws_cloneVec(SwsVector *a)
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;