Commit bcddfd63 authored by ivoire's avatar ivoire
Browse files

Remove useless test before a free (again).

parent 32376dc2
......@@ -314,10 +314,10 @@ static void ASF_FreeObject_metadata( asf_object_t *p_obj )
for( i = 0; i < p_meta->i_record_entries_count; i++ )
{
if( p_meta->record[i].psz_name ) free( p_meta->record[i].psz_name );
if( p_meta->record[i].p_data ) free( p_meta->record[i].p_data );
free( p_meta->record[i].psz_name );
free( p_meta->record[i].p_data );
}
if( p_meta->record ) free( p_meta->record );
free( p_meta->record );
}
static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
......
......@@ -444,7 +444,7 @@ static int AVI_ChunkRead_strd( stream_t *s, avi_chunk_t *p_chk )
static void AVI_ChunkFree_strd( avi_chunk_t *p_chk )
{
if( p_chk->strd.p_data ) free( p_chk->strd.p_data );
free( p_chk->strd.p_data );
}
static int AVI_ChunkRead_idx1( stream_t *s, avi_chunk_t *p_chk )
......
......@@ -400,9 +400,9 @@ error:
vlc_object_detach( p_sys->p_timeout );
vlc_object_release( p_sys->p_timeout );
}
if( p_sys->scheduler ) delete p_sys->scheduler;
if( p_sys->p_sdp ) free( p_sys->p_sdp );
if( p_sys->psz_path ) free( p_sys->psz_path );
delete p_sys->scheduler;
free( p_sys->p_sdp );
free( p_sys->psz_path );
vlc_UrlClean( &p_sys->url );
......@@ -441,9 +441,9 @@ static void Close( vlc_object_t *p_this )
vlc_object_detach( p_sys->p_timeout );
vlc_object_release( p_sys->p_timeout );
}
if( p_sys->scheduler ) delete p_sys->scheduler;
if( p_sys->p_sdp ) free( p_sys->p_sdp );
if( p_sys->psz_path ) free( p_sys->psz_path );
delete p_sys->scheduler;
free( p_sys->p_sdp );
free( p_sys->psz_path );
vlc_UrlClean( &p_sys->url );
......@@ -563,8 +563,8 @@ describe:
int i_result;
msg_Dbg( p_demux, "authentication failed" );
if( psz_user ) free( psz_user );
if( psz_pwd ) free( psz_pwd );
free( psz_user );
free( psz_pwd );
psz_user = psz_pwd = NULL;
i_result = intf_UserLoginPassword( p_demux, _("RTSP authentication"),
......@@ -599,11 +599,11 @@ describe:
}
/* malloc-ated copy */
if( psz_url ) free( psz_url );
if( psz_user ) free( psz_user );
if( psz_pwd ) free( psz_pwd );
free( psz_url );
free( psz_user );
free( psz_pwd );
if( p_sys->p_sdp ) free( p_sys->p_sdp );
free( p_sys->p_sdp );
p_sys->p_sdp = NULL;
if( p_sdp ) p_sys->p_sdp = strdup( (char*)p_sdp );
delete[] p_sdp;
......@@ -1882,7 +1882,7 @@ static unsigned char* parseH264ConfigStr( char const* configStr,
psz += strlen(psz)+1;
}
if( dup ) free( dup );
free( dup );
return cfg;
}
......
......@@ -1048,35 +1048,17 @@ public:
delete tracks[i_track]->p_compression_data;
}
es_format_Clean( &tracks[i_track]->fmt );
if( tracks[i_track]->p_extra_data )
free( tracks[i_track]->p_extra_data );
if( tracks[i_track]->psz_codec )
free( tracks[i_track]->psz_codec );
free( tracks[i_track]->p_extra_data );
free( tracks[i_track]->psz_codec );
delete tracks[i_track];
}
if( psz_writing_application )
{
free( psz_writing_application );
}
if( psz_muxing_application )
{
free( psz_muxing_application );
}
if( psz_segment_filename )
{
free( psz_segment_filename );
}
if( psz_title )
{
free( psz_title );
}
if( psz_date_utc )
{
free( psz_date_utc );
}
if ( p_indexes )
free( p_indexes );
free( psz_writing_application );
free( psz_muxing_application );
free( psz_segment_filename );
free( psz_title );
free( psz_date_utc );
free( p_indexes );
delete ep;
delete segment;
......@@ -1313,7 +1295,7 @@ public:
{}
virtual ~attachment_c()
{
if( p_data ) free( p_data );
free( p_data );
}
std::string psz_file_name;
......
......@@ -439,7 +439,7 @@ static int Open( vlc_object_t * p_this )
msg_Err( p_demux, "unknown ref type=%4.4s FIXME (send a bug report)",
(char*)&p_rdrf->data.p_rdrf->i_ref_type );
}
if( psz_ref ) free( psz_ref );
free( psz_ref );
}
if( b_play && p_item_in_category &&
p_item_in_category->i_children > 0 )
......
......@@ -341,7 +341,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
if( psz_out )
{
msg_Dbg( p_demux, "%s = %s", psz_bol, psz_out );
if( psz_out) free( psz_out );
free( psz_out );
}
}
return VLC_SUCCESS;
......@@ -359,7 +359,7 @@ static int Demux ( demux_t *p_demux )
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
ParseLine( p_demux, psz_line );
if( psz_line ) free( psz_line );
free( psz_line );
}
return VLC_SUCCESS;
}
......
......@@ -1191,8 +1191,7 @@ static void Ogg_EndOfStream( demux_t *p_demux )
p_ogg->i_bitrate -= p_stream->fmt.i_bitrate;
ogg_stream_clear( &p_ogg->pp_stream[i_stream]->os );
if( p_ogg->pp_stream[i_stream]->p_headers)
free( p_ogg->pp_stream[i_stream]->p_headers );
free( p_ogg->pp_stream[i_stream]->p_headers );
es_format_Clean( &p_stream->fmt );
......@@ -1201,7 +1200,7 @@ static void Ogg_EndOfStream( demux_t *p_demux )
#undef p_stream
/* Reinit p_ogg */
if( p_ogg->pp_stream ) free( p_ogg->pp_stream );
free( p_ogg->pp_stream );
p_ogg->pp_stream = NULL;
p_ogg->i_streams = 0;
}
......
......@@ -61,7 +61,7 @@ static int StoreString( demux_t *p_demux, char **ppsz_string,
demux_sys_t *p_sys = p_demux->p_sys;
unsigned len = psz_source_end - psz_source_start;
if( *ppsz_string ) free( *ppsz_string );
free( *ppsz_string );
char *buf = *ppsz_string = malloc ((len * (1 + !p_sys->b_utf8)) + 1);
if (buf == NULL)
......@@ -221,8 +221,8 @@ void E_(Close_ASX)( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
if( p_sys->psz_prefix ) free( p_sys->psz_prefix );
if( p_sys->psz_data ) free( p_sys->psz_data );
free( p_sys->psz_prefix );
free( p_sys->psz_data );
free( p_sys );
}
......
......@@ -72,7 +72,7 @@ void E_(Close_B4S)( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
if( p_sys->psz_prefix ) free( p_sys->psz_prefix );
free( p_sys->psz_prefix );
if( p_sys->p_xml_reader ) xml_ReaderDelete( p_sys->p_xml, p_sys->p_xml_reader );
if( p_sys->p_xml ) xml_Delete( p_sys->p_xml );
free( p_sys );
......@@ -97,7 +97,7 @@ static int Demux( demux_t *p_demux )
if( !p_xml ) return -1;
psz_elname = stream_ReadLine( p_demux->s );
if( psz_elname ) free( psz_elname );
free( psz_elname );
psz_elname = 0;
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
......@@ -119,7 +119,7 @@ static int Demux( demux_t *p_demux )
{
msg_Err( p_demux, "invalid root node %i, %s",
xml_ReaderNodeType( p_xml_reader ), psz_elname );
if( psz_elname ) free( psz_elname );
free( psz_elname );
vlc_object_release( p_playlist );
return -1;
}
......@@ -141,7 +141,7 @@ static int Demux( demux_t *p_demux )
strcmp( psz_elname, "playlist" ) )
{
msg_Err( p_demux, "invalid child node %s", psz_elname );
if( psz_elname ) free( psz_elname );
free( psz_elname );
return -1;
}
free( psz_elname ); psz_elname = 0;
......@@ -183,7 +183,7 @@ static int Demux( demux_t *p_demux )
case XML_READER_STARTELEM:
{
// Read the element name
if( psz_elname ) free( psz_elname );
free( psz_elname );
psz_elname = xml_ReaderName( p_xml_reader );
if( !psz_elname ) return -1;
......
......@@ -126,7 +126,7 @@ static int Demux( demux_t *p_demux )
input_ItemAddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
while( i_options-- ) free( ppsz_options[i_options] );
if( ppsz_options ) free( ppsz_options );
free( ppsz_options );
free( psz_line );
}
......@@ -280,7 +280,7 @@ static int ParseLine( char *psz_line, char **ppsz_name,
{
/* This isn't a valid channels file, cleanup everything */
while( (*pi_options)-- ) free( (*pppsz_options)[*pi_options] );
if( *pppsz_options ) free( *pppsz_options );
free( *pppsz_options );
*pppsz_options = 0; *pi_options = 0;
}
......
......@@ -212,11 +212,11 @@ static int Demux( demux_t *p_demux )
{
/* Cleanup state */
while( i_options-- ) free( (char*)ppsz_options[i_options] );
if( ppsz_options ) free( ppsz_options );
free( ppsz_options );
ppsz_options = NULL; i_options = 0;
if( psz_name ) free( psz_name );
free( psz_name );
psz_name = NULL;
if ( psz_artist ) free( psz_artist );
free( psz_artist );
psz_artist = NULL;
i_parsed_duration = 0;
i_duration = -1;
......
......@@ -75,7 +75,7 @@ void E_(Close_podcast)( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
if( p_sys->psz_prefix ) free( p_sys->psz_prefix );
free( p_sys->psz_prefix );
if( p_sys->p_playlist ) vlc_object_release( p_sys->p_playlist );
if( p_sys->p_xml_reader ) xml_ReaderDelete( p_sys->p_xml, p_sys->p_xml_reader );
if( p_sys->p_xml ) xml_Delete( p_sys->p_xml );
......@@ -134,7 +134,7 @@ static int Demux( demux_t *p_demux )
{
msg_Err( p_demux, "invalid root node %i, %s",
xml_ReaderNodeType( p_xml_reader ), psz_elname );
if( psz_elname ) free( psz_elname );
free( psz_elname );
return -1;
}
free( psz_elname ); psz_elname = NULL;
......@@ -153,7 +153,7 @@ static int Demux( demux_t *p_demux )
case XML_READER_STARTELEM:
{
// Read the element name
if( psz_elname ) free( psz_elname );
free( psz_elname );
psz_elname = xml_ReaderName( p_xml_reader );
if( !psz_elname ) return -1;
......
......@@ -183,20 +183,13 @@ void E_(Close_SGIMB)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
if( p_sys->psz_uri )
free( p_sys->psz_uri );
if( p_sys->psz_server )
free( p_sys->psz_server );
if( p_sys->psz_location )
free( p_sys->psz_location );
if( p_sys->psz_name )
free( p_sys->psz_name );
if( p_sys->psz_user )
free( p_sys->psz_user );
if( p_sys->psz_password )
free( p_sys->psz_password );
if( p_sys->psz_mcast_ip )
free( p_sys->psz_mcast_ip );
free( p_sys->psz_uri );
free( p_sys->psz_server );
free( p_sys->psz_location );
free( p_sys->psz_name );
free( p_sys->psz_user );
free( p_sys->psz_password );
free( p_sys->psz_mcast_ip );
free( p_demux->p_sys );
return;
}
......@@ -325,7 +318,7 @@ static int Demux ( demux_t *p_demux )
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
ParseLine( p_demux, psz_line );
if( psz_line ) free( psz_line );
free( psz_line );
}
if( p_sys->psz_mcast_ip )
......@@ -335,7 +328,7 @@ static int Demux ( demux_t *p_demux )
char *temp;
asprintf( &temp, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
if( p_sys->psz_uri ) free( p_sys->psz_uri );
free( p_sys->psz_uri );
p_sys->psz_uri = strdup( temp );
free( temp );
}
......
......@@ -132,7 +132,7 @@ static int Demux( demux_t *p_demux )
{
msg_Err( p_demux, "invalid root node %i, %s",
xml_ReaderNodeType( p_xml_reader ), psz_eltname );
if( psz_eltname ) free( psz_eltname );
free( psz_eltname );
return -1;
}
......
......@@ -497,11 +497,10 @@ static inline void ps_psm_destroy( ps_psm_t *p_psm )
{
while( p_psm->i_es-- )
{
if( p_psm->es[p_psm->i_es]->i_descriptor )
free( p_psm->es[p_psm->i_es]->p_descriptor );
free( p_psm->es[p_psm->i_es]->p_descriptor );
free( p_psm->es[p_psm->i_es] );
}
if( p_psm->es ) free( p_psm->es );
free( p_psm->es );
p_psm->es = 0;
p_psm->i_es = 0;
......
......@@ -216,10 +216,10 @@ static void Close( vlc_object_t *p_this )
free( tk );
}
if( p_sys->psz_title ) free( p_sys->psz_title );
if( p_sys->psz_artist ) free( p_sys->psz_artist );
if( p_sys->psz_copyright ) free( p_sys->psz_copyright );
if( p_sys->psz_description ) free( p_sys->psz_description );
free( p_sys->psz_title );
free( p_sys->psz_artist );
free( p_sys->psz_copyright );
free( p_sys->psz_description );
if( p_sys->i_track > 0 ) free( p_sys->track );
free( p_sys );
......
......@@ -323,7 +323,7 @@ static int Open ( vlc_object_t *p_this )
s = NULL;
}
if( s ) free( s );
free( s );
/* It will nearly always work even for non seekable stream thanks the
* caching system, and if it fails we lose just a few sub */
......@@ -365,8 +365,7 @@ static int Open ( vlc_object_t *p_this )
sizeof(subtitle_t) * i_max ) ) )
{
msg_Err( p_demux, "out of memory");
if( p_sys->subtitle != NULL )
free( p_sys->subtitle );
free( p_sys->subtitle );
TextUnload( &p_sys->txt );
free( p_sys );
return VLC_ENOMEM;
......@@ -426,12 +425,8 @@ static void Close( vlc_object_t *p_this )
int i;
for( i = 0; i < p_sys->i_subtitles; i++ )
{
if( p_sys->subtitle[i].psz_text )
free( p_sys->subtitle[i].psz_text );
}
if( p_sys->subtitle )
free( p_sys->subtitle );
free( p_sys->subtitle[i].psz_text );
free( p_sys->subtitle );
free( p_sys );
}
......
......@@ -692,10 +692,7 @@ static int Open( vlc_object_t *p_this )
p_sys->buffer = malloc( p_sys->i_packet_size * p_sys->i_ts_read );
}
}
if( val.psz_string )
{
free( val.psz_string );
}
free( val.psz_string );
/* We handle description of an extra PMT */
var_Create( p_demux, "ts-extra-pmt", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
......@@ -773,10 +770,7 @@ static int Open( vlc_object_t *p_this )
}
}
}
if( val.psz_string )
{
free( val.psz_string );
}
free( val.psz_string );
var_Create( p_demux, "ts-csa-ck", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_demux, "ts-csa-ck", &val );
......@@ -830,10 +824,7 @@ static int Open( vlc_object_t *p_this )
}
}
}
if( val.psz_string )
{
free( val.psz_string );
}
free( val.psz_string );
var_Create( p_demux, "ts-silent", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_demux, "ts-silent", &val );
......@@ -1494,7 +1485,7 @@ static void PIDClean( es_out_t *out, ts_pid_t *pid )
dvbpsi_DetachPMT( pid->psi->prg[i]->handle );
free( pid->psi->prg[i] );
}
if( pid->psi->prg ) free( pid->psi->prg );
free( pid->psi->prg );
free( pid->psi );
}
else
......@@ -2835,10 +2826,8 @@ static void EITCallBack( demux_t *p_demux, dvbpsi_eit_t *p_eit )
strcat( psz_extra, psz_itm );
strcat( psz_extra, ")" );
}
if( psz_dsc )
free( psz_dsc );
if( psz_itm )
free( psz_itm );
free( psz_dsc );
free( psz_itm );
}
}
}
......@@ -2856,10 +2845,8 @@ static void EITCallBack( demux_t *p_demux, dvbpsi_eit_t *p_eit )
if( p_evt->i_running_status == 0x04 && i_start > 0 )
vlc_epg_SetCurrent( p_epg, i_start );
if( psz_name )
free( psz_name );
if( psz_text )
free( psz_text );
free( psz_name );
free( psz_text );
free( psz_extra );
}
......@@ -3878,7 +3865,7 @@ static void PATCallBack( demux_t *p_demux, dvbpsi_pat_t *p_pat )
TAB_REMOVE( p_sys->i_pmt, p_sys->pmt, pmt_rm[i] );
}
if( pmt_rm ) free( pmt_rm );
free( pmt_rm );
}
/* now create programs */
......
......@@ -211,10 +211,9 @@ static void Close( vlc_object_t *p_this )
/* Clean all subs from all tracks */
for( i = 0; i < p_sys->i_tracks; i++ )
{
if( p_sys->track[i].p_subtitles ) free( p_sys->track[i].p_subtitles );
}
if( p_sys->track ) free( p_sys->track );
free( p_sys->track[i].p_subtitles );
free( p_sys->track );
if( p_sys->p_vobsub_stream )
stream_Delete( p_sys->p_vobsub_stream );
......@@ -435,7 +434,7 @@ static int TextLoad( text_t *txt, stream_t *s )
if( txt->i_line_count <= 0 )
{
if( txt->line ) free( txt->line );
free( txt->line );
return VLC_EGENERIC;
}
......@@ -446,10 +445,9 @@ static void TextUnload( text_t *txt )
int i;
for( i = 0; i < txt->i_line_count; i++ )
{
if( txt->line[i] ) free( txt->line[i] );
}
if( txt->line ) free( txt->line );
free( txt->line[i] );
free( txt->line );
txt->i_line = 0;
txt->i_line_count = 0;
}
......
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