From 0f2c1f43182106c63ed499de2c04d2b47788cf97 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 12 Jan 2017 22:58:33 +0100 Subject: [PATCH] src/pitch/pitchyinfft.c: return NULL if fft creation failed --- src/pitch/pitchyinfft.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pitch/pitchyinfft.c b/src/pitch/pitchyinfft.c index 98de63c7..9243e24f 100644 --- a/src/pitch/pitchyinfft.c +++ b/src/pitch/pitchyinfft.c @@ -62,6 +62,7 @@ new_aubio_pitchyinfft (uint_t samplerate, uint_t bufsize) aubio_pitchyinfft_t *p = AUBIO_NEW (aubio_pitchyinfft_t); p->winput = new_fvec (bufsize); p->fft = new_aubio_fft (bufsize); + if (!p->fft) goto beach; p->fftout = new_fvec (bufsize); p->sqrmag = new_fvec (bufsize); p->yinfft = new_fvec (bufsize / 2 + 1); @@ -95,6 +96,11 @@ new_aubio_pitchyinfft (uint_t samplerate, uint_t bufsize) // check for octave errors above 1300 Hz p->short_period = (uint_t)ROUND(samplerate / 1300.); return p; + +beach: + if (p->winput) del_fvec(p->winput); + AUBIO_FREE(p); + return NULL; } void -- 2.11.0