[vlc-commits] visual: check for NULL before free
Edward Wang
git at videolan.org
Wed Aug 1 15:41:20 CEST 2012
vlc/vlc-2.0 | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat May 26 19:04:57 2012 -0400| [fcde0be30ef6790239cae0832b3367e2876e79c2] | committer: Rémi Denis-Courmont
visual: check for NULL before free
Close #6879
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 73e246278f8ef609ab9ac07272343c3faba8d644)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=fcde0be30ef6790239cae0832b3367e2876e79c2
---
modules/visualization/visual/visual.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index 964924c..a91faa7 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -373,20 +373,23 @@ static void Close( vlc_object_t *p_this )
for( int i = 0; i < p_sys->i_effect; i++ )
{
#define p_effect p_sys->effect[i]
- if( !strncmp( p_effect->psz_name, "spectrum", strlen( "spectrum" ) ) )
+ if( p_effect->p_data != NULL )
{
- spectrum_data *p_data = p_effect->p_data;
- free( p_data->peaks );
- free( p_data->prev_heights );
- free( p_data->p_prev_s16_buff );
- }
- if( !strncmp( p_effect->psz_name, "spectrometer", strlen( "spectrometer" ) ) )
- {
- spectrometer_data *p_data = p_effect->p_data;
- free( p_data->peaks );
- free( p_data->p_prev_s16_buff );
+ if( !strncmp( p_effect->psz_name, "spectrum", strlen( "spectrum" ) ) )
+ {
+ spectrum_data* p_data = p_effect->p_data;
+ free( p_data->peaks );
+ free( p_data->prev_heights );
+ free( p_data->p_prev_s16_buff );
+ }
+ if( !strncmp( p_effect->psz_name, "spectrometer", strlen( "spectrometer" ) ) )
+ {
+ spectrometer_data* p_data = p_effect->p_data;
+ free( p_data->peaks );
+ free( p_data->p_prev_s16_buff );
+ }
+ free( p_effect->p_data );
}
- free( p_effect->p_data );
free( p_effect->psz_args );
free( p_effect );
#undef p_effect
More information about the vlc-commits
mailing list