]> git.sesse.net Git - vlc/commitdiff
visual: fix a crash (double free or use after free) if an error occure.
authorRémi Duraffort <ivoire@videolan.org>
Thu, 19 Nov 2009 12:57:09 +0000 (13:57 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 19 Nov 2009 15:26:47 +0000 (16:26 +0100)
modules/visualization/visual/effects.c

index d93efac39d7d85777165102046443a2d63313b73..473cd4148d6f11e2abd57aa0012959b60ac11591 100644 (file)
@@ -386,7 +386,7 @@ int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
     fft_state *p_state;                 /* internal FFT data */
 
     int i , j , k;
-    int i_line;
+    int i_line = 0;
     int16_t p_dest[FFT_BUFFER_SIZE];      /* Adapted FFT result */
     int16_t p_buffer1[FFT_BUFFER_SIZE];   /* Buffer on which we perform
                                              the FFT (first channel) */
@@ -396,8 +396,6 @@ int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
     int16_t  *p_buffs;                    /* int16_t converted buffer */
     int16_t  *p_s16_buff;                /* int16_t converted buffer */
 
-    i_line = 0;
-
     p_s16_buff = malloc( p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(int16_t) );
     if( !p_s16_buff )
         return -1;
@@ -441,7 +439,6 @@ int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
     height = malloc( i_nb_bands * sizeof(int) );
     if( !height)
     {
-        free( p_effect->p_data );
         free( p_s16_buff );
         return -1;
     }
@@ -463,7 +460,6 @@ int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
     {
         msg_Err(p_aout,"unable to initialize FFT transform");
         free( height );
-        free( p_effect->p_data );
         free( p_s16_buff );
         return -1;
     }