From: Paul Brossier Date: Sun, 11 Oct 2009 10:40:04 +0000 (+0200) Subject: src/spectral/fft.c: make sure we set allocated vectors to 0 X-Git-Tag: bzr2git~141 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4f4299de894cee1b49238114c80f5c865a1a6026;p=aubio.git src/spectral/fft.c: make sure we set allocated vectors to 0 --- diff --git a/src/spectral/fft.c b/src/spectral/fft.c index c3af6a2d..71acca64 100644 --- a/src/spectral/fft.c +++ b/src/spectral/fft.c @@ -83,6 +83,7 @@ struct _aubio_fft_t { aubio_fft_t * new_aubio_fft(uint_t winsize, uint_t channels) { aubio_fft_t * s = AUBIO_NEW(aubio_fft_t); + uint_t i; s->winsize = winsize; s->channels = channels; /* allocate memory */ @@ -101,6 +102,13 @@ aubio_fft_t * new_aubio_fft(uint_t winsize, uint_t channels) { s->pfw = fftw_plan_r2r_1d(winsize, s->in, s->specdata, FFTW_R2HC, FFTW_ESTIMATE); s->pbw = fftw_plan_r2r_1d(winsize, s->specdata, s->out, FFTW_HC2R, FFTW_ESTIMATE); #endif + for (i = 0; i < s->winsize; i++) { + s->in[i] = 0.; + s->out[i] = 0.; + } + for (i = 0; i < s->fft_size; i++) { + s->specdata[i] = 0.; + } return s; }