Commit fcde0be3 authored by Edward Wang's avatar Edward Wang Committed by Rémi Denis-Courmont

visual: check for NULL before free

Close #6879
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 73e246278f8ef609ab9ac07272343c3faba8d644)
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 0f664fbe
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment