If the buffer allocation fails, return NULL.
Unified · Split
| @@ -362,6 +362,9 @@ double * lsx_make_lpf(int num_taps, double Fc, double beta, double rho, · 361 unmodified lines | ||
| 362 | 362 | assert(Fc >= 0 && Fc <= 1); |
| 363 | 363 | lsx_debug("make_lpf(n=%i Fc=%.7g β=%g ρ=%g dc-norm=%i scale=%g)", num_taps, Fc, beta, rho, dc_norm, scale); |
| 364 | 364 | |
| 365 | + if (!h) | |
| 366 | + return NULL; | |
| 367 | + | |
| 365 | 368 | for (i = 0; i <= m / 2; ++i) { |
| 366 | 369 | double z = i - .5 * m, x = z * M_PI, y = z * mult1; |
| 367 | 370 | h[i] = x? sin(Fc * x) / x : Fc; |