fixed leaked ritrev table
authorJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Fri, 8 Feb 2008 05:08:40 +0000 (16:08 +1100)
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Fri, 8 Feb 2008 05:08:40 +0000 (16:08 +1100)
libcelt/celt.c
libcelt/kiss_fft.c

index 26f337a..0adc610 100644 (file)
@@ -130,7 +130,7 @@ void celt_encoder_destroy(CELTEncoder *st)
    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);
index eb864e6..5e7ca19 100644 (file)
@@ -609,7 +609,7 @@ kiss_fft_cfg kiss_fft_alloc(int nfft,void * mem,size_t * lenmem )
 {
     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 @@ kiss_fft_cfg kiss_fft_alloc(int nfft,void * mem,size_t * lenmem )
         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;