From 5d99f7d3d511734c10f462f74114e85fa794d21b Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Thu, 19 Nov 2009 13:57:09 +0100 Subject: [PATCH] visual: fix a crash (double free or use after free) if an error occure. --- modules/visualization/visual/effects.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/visualization/visual/effects.c b/modules/visualization/visual/effects.c index d93efac39d..473cd4148d 100644 --- a/modules/visualization/visual/effects.c +++ b/modules/visualization/visual/effects.c @@ -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; } -- 2.39.2