fix memory leak

pull/30/head
David 2020-05-29 20:22:57 +09:30
parent 8182b73dac
commit 163a6499ea
4 changed files with 8 additions and 1 deletions

View File

@ -113,6 +113,7 @@ int codec2_pitch_est(CODEC2_PITCH *pitch, float Sn[], float *f0, float *voicing)
void codec2_pitch_destroy(CODEC2_PITCH *pitch)
{
free(pitch->fft_fwd_cfg);
nlp_destroy(pitch->nlp_states);
free(pitch->w);
free(pitch);

View File

@ -140,6 +140,10 @@ static void check_init() {
common.init = 1;
}
void freq_close() {
opus_fft_free(common.kfft,0);
}
void dct(float *out, const float *in) {
int i;
check_init();

View File

@ -42,6 +42,7 @@
#define NB_BANDS 18
void freq_close(void);
void compute_band_energy(float *bandE, const kiss_fft_cpx *X);
void compute_band_corr(float *bandE, const kiss_fft_cpx *X, const kiss_fft_cpx *P);

View File

@ -87,7 +87,8 @@ static DenoiseState *rnnoise_create() {
}
static void rnnoise_destroy(DenoiseState *st) {
free(st);
freq_close();
free(st);
}
static short float2short(float x)