mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
replace calloc with remaining values emptying
This commit is contained in:
parent
c8262660f0
commit
12c8cf94f2
|
@ -102,10 +102,8 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp,
|
||||||
if (outSize > INT_MAX / (2 * sizeof(double)))
|
if (outSize > INT_MAX / (2 * sizeof(double)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* coefficient buffer. kmax elements for each of outSize pixels.
|
/* coefficient buffer */
|
||||||
Only xmax number of coefficients are initialized (xmax <= kmax),
|
kk = malloc(outSize * kmax * sizeof(double));
|
||||||
other coefficients should be 0, so we are using calloc. */
|
|
||||||
kk = calloc(outSize * kmax, sizeof(double));
|
|
||||||
if ( ! kk)
|
if ( ! kk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -136,6 +134,10 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp,
|
||||||
if (ww != 0.0)
|
if (ww != 0.0)
|
||||||
k[x] /= ww;
|
k[x] /= ww;
|
||||||
}
|
}
|
||||||
|
// Remaining values should stay empty if they are used despite of xmax.
|
||||||
|
for (; x < kmax; x++) {
|
||||||
|
k[x] = 0;
|
||||||
|
}
|
||||||
xbounds[xx * 2 + 0] = xmin;
|
xbounds[xx * 2 + 0] = xmin;
|
||||||
xbounds[xx * 2 + 1] = xmax;
|
xbounds[xx * 2 + 1] = xmax;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user