Commit 6411526f authored by Rémi Duraffort's avatar Rémi Duraffort

One more removing session. (useless test before a free())

parent 5cb4066e
......@@ -201,8 +201,7 @@ static int Open( vlc_object_t *p_this )
TAB_APPEND( p_sys->i_handlers, p_sys->pp_handlers, p_handler );
}
}
if( psz_src != NULL )
free( psz_src );
free( psz_src );
#endif
/* determine SSL configuration */
......@@ -275,11 +274,8 @@ static int Open( vlc_object_t *p_this )
};
unsigned i;
if( psz_src != NULL )
{
free( psz_src );
psz_src = NULL;
}
free( psz_src );
psz_src = NULL;
for( i = 0; ppsz_paths[i] != NULL; i++ )
if( !DirectoryCheck( ppsz_paths[i] ) )
......@@ -372,10 +368,7 @@ static void Close ( vlc_object_t *p_this )
free( p_sys->pp_files[i]->name );
free( p_sys->pp_files[i] );
}
if( p_sys->pp_files )
{
free( p_sys->pp_files );
}
free( p_sys->pp_files );
for( i = 0; i < p_sys->i_handlers; i++ )
{
http_association_t *p_handler = p_sys->pp_handlers[i];
......@@ -794,8 +787,7 @@ int E_(HandlerCallback)( httpd_handler_sys_t *p_args,
NULL );
TAB_REMOVE( p_args->p_association->i_argc, p_args->p_association->ppsz_argv,
psz_file );
if( psz_cwd != NULL )
free( psz_cwd );
free( psz_cwd );
while( i_env )
TAB_REMOVE( i_env, ppsz_env, ppsz_env[0] );
......
......@@ -328,14 +328,8 @@ int E_(ParseDirectory)( intf_thread_t *p_intf, char *psz_root,
}
}
if( user )
{
free( user );
}
if( password )
{
free( password );
}
free( user );
free( password );
ACL_Destroy( p_acl );
closedir( p_dir );
......
......@@ -123,8 +123,7 @@ static void Close( vlc_object_t *p_this )
intf_thread_t *p_intf = (intf_thread_t *)p_this;
/* Destroy structure */
if( p_intf->p_sys->psz_file )
free( p_intf->p_sys->psz_file );
free( p_intf->p_sys->psz_file );
lirc_freeconfig( p_intf->p_sys->config );
lirc_deinit();
free( p_intf->p_sys );
......
......@@ -196,7 +196,7 @@ static int NTServiceInstall( intf_thread_t *p_intf )
strcat( psz_path, " --ntservice-extraintf " );
strcat( psz_path, psz_extra );
}
if( psz_extra ) free( psz_extra );
free( psz_extra );
psz_extra = config_GetPsz( p_intf, "ntservice-options" );
if( psz_extra && *psz_extra )
......@@ -204,7 +204,7 @@ static int NTServiceInstall( intf_thread_t *p_intf )
strcat( psz_path, " " );
strcat( psz_path, psz_extra );
}
if( psz_extra ) free( psz_extra );
free( psz_extra );
SC_HANDLE service =
CreateService( handle, p_sys->psz_service, p_sys->psz_service,
......@@ -338,10 +338,7 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
free( psz_temp );
}
}
if( psz_modules )
{
free( psz_modules );
}
free( psz_modules );
/* Initialization complete - report running status */
p_sys->status.dwCurrentState = SERVICE_RUNNING;
......
......@@ -150,8 +150,7 @@ static int Open( vlc_object_t * p_this )
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( !p_sys->p_packetizer->p_module )
{
if( p_sys->p_packetizer->fmt_in.p_extra )
free( p_sys->p_packetizer->fmt_in.p_extra );
free( p_sys->p_packetizer->fmt_in.p_extra );
vlc_object_release( p_sys->p_packetizer );
msg_Err( p_demux, "cannot find flac packetizer" );
......@@ -189,8 +188,7 @@ static void Close( vlc_object_t * p_this )
/* Unneed module */
module_Unneed( p_sys->p_packetizer, p_sys->p_packetizer->p_module );
if( p_sys->p_packetizer->fmt_in.p_extra )
free( p_sys->p_packetizer->fmt_in.p_extra );
free( p_sys->p_packetizer->fmt_in.p_extra );
/* Delete the decoder */
vlc_object_release( p_sys->p_packetizer );
......@@ -712,10 +710,8 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, int i_data )
p_sys->i_cover_score = pi_cover_score[i_type];
}
error:
if( psz_mime )
free( psz_mime );
if( psz_description )
free( psz_description );
free( psz_mime );
free( psz_description );
}
#undef RM
......@@ -511,10 +511,7 @@ static void Close ( 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_separator )
{
free( p_sys->psz_separator );
}
free( p_sys->psz_separator );
free( p_sys );
}
......
......@@ -1208,8 +1208,7 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
if( p_box->i_type == FOURCC_alac )
{
if( p_box->data.p_sample_soun->p_qt_description )
free( p_box->data.p_sample_soun->p_qt_description );
free( p_box->data.p_sample_soun->p_qt_description );
p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
p_box->data.p_sample_soun->i_qt_description = i_read;
......
......@@ -316,8 +316,7 @@ static void Close( 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->p_extra_f )
free( p_sys->p_extra_f );
free( p_sys->p_extra_f );
demux_IndexClean( &p_sys->idx );
free( p_sys );
}
......@@ -644,11 +643,8 @@ static void demux_IndexInit( demux_index_t *p_idx )
}
static void demux_IndexClean( demux_index_t *p_idx )
{
if( p_idx->idx )
{
free( p_idx->idx );
p_idx->idx = NULL;
}
free( p_idx->idx );
p_idx->idx = NULL;
}
static void demux_IndexAppend( demux_index_t *p_idx,
int64_t i_time, int64_t i_offset )
......
......@@ -26,10 +26,10 @@
*/
/* defines */
#define FREE(v) if (v) {free(v);v=NULL;}
#define FREE_NAME() if (psz_name) {free(psz_name);psz_name=NULL;}
#define FREE_VALUE() if (psz_value) {free(psz_value);psz_value=NULL;}
#define FREE_KEY() if (psz_key) {free(psz_key);psz_key=NULL;}
#define FREE(v) free(v);v=NULL;
#define FREE_NAME() free(psz_name);psz_name=NULL;
#define FREE_VALUE() free(psz_value);psz_value=NULL;
#define FREE_KEY() free(psz_key);psz_key=NULL;
#define FREE_ATT() FREE_NAME();FREE_VALUE()
#define FREE_ATT_KEY() FREE_NAME();FREE_VALUE();FREE_KEY()
......
......@@ -73,10 +73,7 @@ int E_(Import_PLS)( vlc_object_t *p_this )
void E_(Close_PLS)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
if( p_demux->p_sys->psz_prefix )
{
free( p_demux->p_sys->psz_prefix );
}
free( p_demux->p_sys->psz_prefix );
free( p_demux->p_sys );
}
......@@ -172,11 +169,8 @@ static int Demux( demux_t *p_demux )
{
msg_Warn( p_demux, "no file= part found for item %d", i_item );
}
if( psz_name )
{
free( psz_name );
psz_name = NULL;
}
free( psz_name );
psz_name = NULL;
i_duration = -1;
i_item = i_new_item;
i_new_item = 0;
......@@ -184,8 +178,7 @@ static int Demux( demux_t *p_demux )
if( !strncasecmp( psz_key, "file", sizeof("file") -1 ) ||
!strncasecmp( psz_key, "Ref", sizeof("Ref") -1 ) )
{
if( psz_mrl_orig )
free( psz_mrl_orig );
free( psz_mrl_orig );
psz_mrl_orig =
psz_mrl = E_(ProcessMRL)( psz_value, p_demux->p_sys->psz_prefix );
......@@ -202,8 +195,7 @@ static int Demux( demux_t *p_demux )
}
else if( !strncasecmp( psz_key, "title", sizeof("title") -1 ) )
{
if( psz_name )
free( psz_name );
free( psz_name );
psz_name = strdup( psz_value );
}
else if( !strncasecmp( psz_key, "length", sizeof("length") -1 ) )
......@@ -234,11 +226,8 @@ static int Demux( demux_t *p_demux )
{
msg_Warn( p_demux, "no file= part found for item %d", i_item );
}
if( psz_name )
{
free( psz_name );
psz_name = NULL;
}
free( psz_name );
psz_name = NULL;
HANDLE_PLAY_AND_RELEASE;
return 0; /* Needed for correct operation of go back */
......
......@@ -310,12 +310,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 );
}
......
......@@ -2399,12 +2399,9 @@ static void IODFree( iod_descriptor_t *p_iod )
}
else
{
if( es_descr.dec_descr.p_decoder_specific_info != NULL )
{
free( es_descr.dec_descr.p_decoder_specific_info );
es_descr.dec_descr.p_decoder_specific_info = NULL;
es_descr.dec_descr.i_decoder_specific_info_len = 0;
}
free( es_descr.dec_descr.p_decoder_specific_info );
es_descr.dec_descr.p_decoder_specific_info = NULL;
es_descr.dec_descr.i_decoder_specific_info_len = 0;
}
}
es_descr.b_ok = 0;
......
......@@ -545,8 +545,7 @@ static void Close( vlc_object_t *p_this )
XdsExit( &p_sys->xds );
cc_Exit( &p_sys->cc );
free( p_sys->rec_hdrs );
if( p_sys->seq_table )
free( p_sys->seq_table );
free( p_sys->seq_table );
free(p_sys);
}
......@@ -1127,23 +1126,16 @@ static void XdsInit( xds_t *h )
static void XdsExit( xds_t *h )
{
/* */
if( h->meta.psz_channel_name )
free( h->meta.psz_channel_name );
if( h->meta.psz_channel_call_letter )
free( h->meta.psz_channel_call_letter );
if( h->meta.psz_channel_number )
free( h->meta.psz_channel_number );
free( h->meta.psz_channel_name );
free( h->meta.psz_channel_call_letter );
free( h->meta.psz_channel_number );
/* */
if( h->meta.current.psz_name )
free( h->meta.current.psz_name );
if( h->meta.current.psz_rating )
free( h->meta.current.psz_rating );
free( h->meta.current.psz_name );
free( h->meta.current.psz_rating );
/* */
if( h->meta.future.psz_name )
free( h->meta.future.psz_name );
if( h->meta.future.psz_rating )
free( h->meta.future.psz_rating );
free( h->meta.future.psz_name );
free( h->meta.future.psz_rating );
}
static void XdsStringUtf8( char dst[2*32+1], const uint8_t *p_src, int i_src )
{
......@@ -1179,8 +1171,7 @@ static vlc_bool_t XdsChangeString( xds_t *h, char **ppsz_dst, const char *psz_ne
if( *ppsz_dst == NULL && psz_new == NULL )
return VLC_FALSE;
if( *ppsz_dst )
free( *ppsz_dst );
free( *ppsz_dst );
if( psz_new )
*ppsz_dst = strdup( psz_new );
else
......@@ -1641,8 +1632,7 @@ static void parse_master(demux_t *p_demux)
entire table directly from the stream into memory in place. */
/* clear the SEQ table */
if (p_sys->seq_table != NULL)
free(p_sys->seq_table);
free(p_sys->seq_table);
/* parse header info */
stream_Read(p_demux->s, mst_buf, 32);
......@@ -1900,8 +1890,7 @@ static int get_chunk_header(demux_t *p_demux)
/*msg_Dbg( p_demux, "chunk has %d records", i_num_recs );*/
if (p_sys->rec_hdrs)
free(p_sys->rec_hdrs);
free(p_sys->rec_hdrs);
/* skip past the 4 bytes we "peeked" earlier */
stream_Read( p_demux->s, NULL, 4 );
......
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