shithub: opus

Download patch

ref: e4475871fbfd903d4b28e34ba3847b0d95cb6be8
parent: 7351e286c81e98b10ddebfbe3e7c31c866fb3ad5
author: Jean-Marc Valin <[email protected]>
date: Fri Feb 8 11:08:40 EST 2008

fixed leaked ritrev table

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -130,7 +130,7 @@
    ec_byte_writeclear(&st->buf);
 
    mdct_clear(&st->mdct_lookup);
-   free(st->fft);
+   kiss_fft_free(st->fft);
 
    celt_free(st->window);
    celt_free(st->in_mem);
--- a/libcelt/kiss_fft.c
+++ b/libcelt/kiss_fft.c
@@ -609,7 +609,7 @@
 {
     kiss_fft_cfg st=NULL;
     size_t memneeded = sizeof(struct kiss_fft_state)
-        + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/
+          + sizeof(kiss_fft_cpx)*(nfft-1) + sizeof(int)*nfft; /* twiddle factors*/
 
     if ( lenmem==NULL ) {
         st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded );
@@ -636,7 +636,7 @@
         kf_factor(nfft,st->factors);
         
         /* bitrev */
-        st->bitrev = celt_alloc(sizeof(int)*(nfft));
+        st->bitrev = (int*)((char*)st + memneeded - sizeof(int)*nfft);
         compute_bitrev_table(st->bitrev, 0, 1,1, st->factors,st);
     }
     return st;