mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +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)))
|
||||
return 0;
|
||||
|
||||
/* coefficient buffer. kmax elements for each of outSize pixels.
|
||||
Only xmax number of coefficients are initialized (xmax <= kmax),
|
||||
other coefficients should be 0, so we are using calloc. */
|
||||
kk = calloc(outSize * kmax, sizeof(double));
|
||||
/* coefficient buffer */
|
||||
kk = malloc(outSize * kmax * sizeof(double));
|
||||
if ( ! kk)
|
||||
return 0;
|
||||
|
||||
|
@ -136,6 +134,10 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp,
|
|||
if (ww != 0.0)
|
||||
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 + 1] = xmax;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user