Commit eb6f43ef authored by Rémi Duraffort's avatar Rémi Duraffort

Remove useless test before a free()

parent 6339478f
...@@ -262,7 +262,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -262,7 +262,7 @@ static int Open( vlc_object_t * p_this )
error: error:
/* If we reach this, this aout has failed */ /* If we reach this, this aout has failed */
var_Destroy( p_aout, "audio-device" ); var_Destroy( p_aout, "audio-device" );
if( p_sys ) free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -432,7 +432,7 @@ static int OpenAnalog( aout_instance_t *p_aout ) ...@@ -432,7 +432,7 @@ static int OpenAnalog( aout_instance_t *p_aout )
"Utilities. Stereo mode is being used now.") ); "Utilities. Stereo mode is being used now.") );
} }
} }
if( layout ) free( layout ); free( layout );
} }
else else
{ {
...@@ -656,7 +656,7 @@ static int OpenSPDIF( aout_instance_t * p_aout ) ...@@ -656,7 +656,7 @@ static int OpenSPDIF( aout_instance_t * p_aout )
if( err != noErr ) if( err != noErr )
{ {
msg_Err( p_aout, "could not get number of streams: [%4.4s]", (char *)&err ); msg_Err( p_aout, "could not get number of streams: [%4.4s]", (char *)&err );
if( p_streams ) free( p_streams ); free( p_streams );
return VLC_FALSE; return VLC_FALSE;
} }
...@@ -691,7 +691,7 @@ static int OpenSPDIF( aout_instance_t * p_aout ) ...@@ -691,7 +691,7 @@ static int OpenSPDIF( aout_instance_t * p_aout )
if( err != noErr ) if( err != noErr )
{ {
msg_Err( p_aout, "could not get the list of streamformats: [%4.4s]", (char *)&err ); msg_Err( p_aout, "could not get the list of streamformats: [%4.4s]", (char *)&err );
if( p_format_list) free( p_format_list); free( p_format_list );
continue; continue;
} }
...@@ -761,9 +761,9 @@ static int OpenSPDIF( aout_instance_t * p_aout ) ...@@ -761,9 +761,9 @@ static int OpenSPDIF( aout_instance_t * p_aout )
p_sys->stream_format = p_format_list[i_current_rate_format]; p_sys->stream_format = p_format_list[i_current_rate_format];
else p_sys->stream_format = p_format_list[i_backup_rate_format]; /* And if we have to, any digital format will be just fine (highest rate possible) */ else p_sys->stream_format = p_format_list[i_backup_rate_format]; /* And if we have to, any digital format will be just fine (highest rate possible) */
} }
if( p_format_list ) free( p_format_list ); free( p_format_list );
} }
if( p_streams ) free( p_streams ); free( p_streams );
msg_Dbg( p_aout, STREAM_FORMAT_MSG( "original stream format: ", p_sys->sfmt_revert ) ); msg_Dbg( p_aout, STREAM_FORMAT_MSG( "original stream format: ", p_sys->sfmt_revert ) );
...@@ -899,7 +899,7 @@ static void Close( vlc_object_t * p_this ) ...@@ -899,7 +899,7 @@ static void Close( vlc_object_t * p_this )
if( err != noErr ) msg_Err( p_aout, "Could not release hogmode: [%4.4s]", (char *)&err ); if( err != noErr ) msg_Err( p_aout, "Could not release hogmode: [%4.4s]", (char *)&err );
} }
if( p_sys ) free( p_sys ); free( p_sys );
} }
/***************************************************************************** /*****************************************************************************
...@@ -1048,12 +1048,12 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -1048,12 +1048,12 @@ static void Probe( aout_instance_t * p_aout )
if( err ) if( err )
goto error; goto error;
if( p_devices ) free( p_devices ); free( p_devices );
return; return;
error: error:
var_Destroy( p_aout, "audio-device" ); var_Destroy( p_aout, "audio-device" );
if( p_devices ) free( p_devices ); free( p_devices );
return; return;
} }
...@@ -1116,7 +1116,7 @@ static int AudioDeviceSupportsDigital( aout_instance_t *p_aout, AudioDeviceID i_ ...@@ -1116,7 +1116,7 @@ static int AudioDeviceSupportsDigital( aout_instance_t *p_aout, AudioDeviceID i_
b_return = VLC_TRUE; b_return = VLC_TRUE;
} }
if( p_streams ) free( p_streams ); free( p_streams );
return b_return; return b_return;
} }
...@@ -1171,7 +1171,7 @@ static int AudioStreamSupportsDigital( aout_instance_t *p_aout, AudioStreamID i_ ...@@ -1171,7 +1171,7 @@ static int AudioStreamSupportsDigital( aout_instance_t *p_aout, AudioStreamID i_
} }
} }
if( p_format_list ) free( p_format_list ); free( p_format_list );
return b_return; return b_return;
} }
......
...@@ -146,7 +146,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -146,7 +146,7 @@ static int Open( vlc_object_t * p_this )
if( !psz_name || !*psz_name ) if( !psz_name || !*psz_name )
{ {
msg_Err( p_aout, "you need to specify an output file name" ); msg_Err( p_aout, "you need to specify an output file name" );
if( psz_name ) free( psz_name ); free( psz_name );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -276,7 +276,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -276,7 +276,7 @@ static int Open( vlc_object_t *p_this )
"use default instead", psz_waveout_dev ); "use default instead", psz_waveout_dev );
} }
} }
if(psz_waveout_dev) free( psz_waveout_dev ); free( psz_waveout_dev );
WAVEOUTCAPS waveoutcaps; WAVEOUTCAPS waveoutcaps;
......
...@@ -144,12 +144,9 @@ static void CloseDecoder( vlc_object_t *p_this ) ...@@ -144,12 +144,9 @@ static void CloseDecoder( vlc_object_t *p_this )
if( !p_sys->pp_ssa_styles[i] ) if( !p_sys->pp_ssa_styles[i] )
continue; continue;
if( p_sys->pp_ssa_styles[i]->psz_stylename ) free( p_sys->pp_ssa_styles[i]->psz_stylename );
free( p_sys->pp_ssa_styles[i]->psz_stylename ); free( p_sys->pp_ssa_styles[i]->font_style.psz_fontname );
if( p_sys->pp_ssa_styles[i]->font_style.psz_fontname ) free( p_sys->pp_ssa_styles[i] );
free( p_sys->pp_ssa_styles[i]->font_style.psz_fontname );
if( p_sys->pp_ssa_styles[i] )
free( p_sys->pp_ssa_styles[i] );
} }
TAB_CLEAN( p_sys->i_ssa_styles, p_sys->pp_ssa_styles ); TAB_CLEAN( p_sys->i_ssa_styles, p_sys->pp_ssa_styles );
} }
...@@ -163,8 +160,7 @@ static void CloseDecoder( vlc_object_t *p_this ) ...@@ -163,8 +160,7 @@ static void CloseDecoder( vlc_object_t *p_this )
if( p_sys->pp_images[i]->p_pic ) if( p_sys->pp_images[i]->p_pic )
p_sys->pp_images[i]->p_pic->pf_release( p_sys->pp_images[i]->p_pic ); p_sys->pp_images[i]->p_pic->pf_release( p_sys->pp_images[i]->p_pic );
if( p_sys->pp_images[i]->psz_filename ) free( p_sys->pp_images[i]->psz_filename );
free( p_sys->pp_images[i]->psz_filename );
free( p_sys->pp_images[i] ); free( p_sys->pp_images[i] );
} }
...@@ -217,7 +213,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block ) ...@@ -217,7 +213,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
if( !p_spu ) if( !p_spu )
{ {
msg_Warn( p_dec, "can't get spu buffer" ); msg_Warn( p_dec, "can't get spu buffer" );
if( psz_subtitle ) free( psz_subtitle ); free( psz_subtitle );
return NULL; return NULL;
} }
...@@ -233,7 +229,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block ) ...@@ -233,7 +229,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
p_spu->i_original_picture_width = p_sys->i_original_width; p_spu->i_original_picture_width = p_sys->i_original_width;
p_spu->i_original_picture_height = p_sys->i_original_height; p_spu->i_original_picture_height = p_sys->i_original_height;
if( psz_subtitle ) free( psz_subtitle ); free( psz_subtitle );
return p_spu; return p_spu;
} }
...@@ -635,8 +631,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -635,8 +631,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
else if( !strcasecmp( "y", psz_name ) ) else if( !strcasecmp( "y", psz_name ) )
p_sys->i_original_height = atoi( psz_value ); p_sys->i_original_height = atoi( psz_value );
} }
if( psz_name ) free( psz_name ); free( psz_name );
if( psz_value ) free( psz_value ); free( psz_value );
} }
} }
else if( !strcasecmp( "styles", psz_node ) && (i_style_level == 0) ) else if( !strcasecmp( "styles", psz_node ) && (i_style_level == 0) )
...@@ -682,8 +678,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -682,8 +678,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
if( !strcasecmp( "name", psz_name ) ) if( !strcasecmp( "name", psz_name ) )
p_style->psz_stylename = strdup( psz_value); p_style->psz_stylename = strdup( psz_value);
} }
if( psz_name ) free( psz_name ); free( psz_name );
if( psz_value ) free( psz_value ); free( psz_value );
} }
} }
else if( !strcasecmp( "fontstyle", psz_node ) && (i_style_level == 2) ) else if( !strcasecmp( "fontstyle", psz_node ) && (i_style_level == 2) )
...@@ -697,8 +693,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -697,8 +693,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
{ {
if( !strcasecmp( "face", psz_name ) ) if( !strcasecmp( "face", psz_name ) )
{ {
if( p_style->font_style.psz_fontname ) free( p_style->font_style.psz_fontname );
free( p_style->font_style.psz_fontname );
p_style->font_style.psz_fontname = strdup( psz_value ); p_style->font_style.psz_fontname = strdup( psz_value );
} }
else if( !strcasecmp( "size", psz_name ) ) else if( !strcasecmp( "size", psz_name ) )
...@@ -788,8 +783,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -788,8 +783,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
p_style->font_style.i_spacing = atoi( psz_value ); p_style->font_style.i_spacing = atoi( psz_value );
} }
} }
if( psz_name ) free( psz_name ); free( psz_name );
if( psz_value ) free( psz_value ); free( psz_value );
} }
} }
else if( !strcasecmp( "position", psz_node ) && (i_style_level == 2) ) else if( !strcasecmp( "position", psz_node ) && (i_style_level == 2) )
...@@ -849,8 +844,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -849,8 +844,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
} }
} }
} }
if( psz_name ) free( psz_name ); free( psz_name );
if( psz_value ) free( psz_value ); free( psz_value );
} }
} }
...@@ -858,7 +853,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -858,7 +853,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
break; break;
} }
} }
if( p_style ) free( p_style ); free( p_style );
} }
......
...@@ -179,10 +179,10 @@ static void Close( vlc_object_t *p_this ) ...@@ -179,10 +179,10 @@ static void Close( vlc_object_t *p_this )
while( p_sys->i_devices_number > 0 ) while( p_sys->i_devices_number > 0 )
{ {
p_udi_entry = p_sys->pp_devices[0]; p_udi_entry = p_sys->pp_devices[0];
if( p_udi_entry->psz_udi ) free( p_udi_entry->psz_udi ); free( p_udi_entry->psz_udi );
TAB_REMOVE( p_sys->i_devices_number, p_sys->pp_devices, TAB_REMOVE( p_sys->i_devices_number, p_sys->pp_devices,
p_sys->pp_devices[0] ); p_sys->pp_devices[0] );
if( p_udi_entry ) free( p_udi_entry ); free( p_udi_entry );
} }
p_sys->pp_devices = NULL; p_sys->pp_devices = NULL;
#endif #endif
...@@ -258,8 +258,7 @@ static void DelItem( services_discovery_t *p_sd, const char* psz_udi ) ...@@ -258,8 +258,7 @@ static void DelItem( services_discovery_t *p_sd, const char* psz_udi )
{ /* delete the corresponding item */ { /* delete the corresponding item */
services_discovery_RemoveItem( p_sd, p_sys->pp_devices[i]->p_item ); services_discovery_RemoveItem( p_sd, p_sys->pp_devices[i]->p_item );
vlc_gc_decref( p_sys->pp_devices[i]->p_item ); vlc_gc_decref( p_sys->pp_devices[i]->p_item );
if( p_sys->pp_devices[i]->psz_udi ) free( p_sys->pp_devices[i]->psz_udi );
free( p_sys->pp_devices[i]->psz_udi );
TAB_REMOVE( p_sys->i_devices_number, p_sys->pp_devices, TAB_REMOVE( p_sys->i_devices_number, p_sys->pp_devices,
p_sys->pp_devices[i] ); p_sys->pp_devices[i] );
} }
......
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