Commit 5cb4066e authored by Rémi Duraffort's avatar Rémi Duraffort

Useless test before a free()

parent ac5fe543
...@@ -54,10 +54,7 @@ int var_buffer_reinitwrite( var_buffer_t *p_buf, int i_default_size ) ...@@ -54,10 +54,7 @@ int var_buffer_reinitwrite( var_buffer_t *p_buf, int i_default_size )
if( p_buf->i_size < i_default_size ) if( p_buf->i_size < i_default_size )
{ {
p_buf->i_size = i_default_size; p_buf->i_size = i_default_size;
if( p_buf->p_data )
{
free( p_buf->p_data ); free( p_buf->p_data );
}
p_buf->p_data = malloc( p_buf->i_size ); p_buf->p_data = malloc( p_buf->i_size );
} }
if( !p_buf->p_data ) if( !p_buf->p_data )
...@@ -151,10 +148,7 @@ void var_buffer_addUTF16( var_buffer_t *p_buf, const char *p_str ) ...@@ -151,10 +148,7 @@ void var_buffer_addUTF16( var_buffer_t *p_buf, const char *p_str )
void var_buffer_free( var_buffer_t *p_buf ) void var_buffer_free( var_buffer_t *p_buf )
{ {
if( p_buf->p_data )
{
free( p_buf->p_data ); free( p_buf->p_data );
}
p_buf->i_data = 0; p_buf->i_data = 0;
p_buf->i_size = 0; p_buf->i_size = 0;
} }
......
...@@ -226,7 +226,6 @@ void E_( MMSHClose )( access_t *p_access ) ...@@ -226,7 +226,6 @@ void E_( MMSHClose )( access_t *p_access )
Stop( p_access ); Stop( p_access );
if( p_sys->p_header )
free( p_sys->p_header ); free( p_sys->p_header );
vlc_UrlClean( &p_sys->proxy ); vlc_UrlClean( &p_sys->proxy );
...@@ -732,7 +731,6 @@ static void GetHeader( access_t *p_access ) ...@@ -732,7 +731,6 @@ static void GetHeader( access_t *p_access )
/* Read the asf header */ /* Read the asf header */
p_sys->i_header = 0; p_sys->i_header = 0;
if( p_sys->p_header )
free( p_sys->p_header ); free( p_sys->p_header );
p_sys->p_header = NULL; p_sys->p_header = NULL;
for( ;; ) for( ;; )
......
...@@ -1099,10 +1099,7 @@ static int mms_ParseCommand( access_t *p_access, ...@@ -1099,10 +1099,7 @@ static int mms_ParseCommand( access_t *p_access,
int i_length; int i_length;
uint32_t i_id; uint32_t i_id;
if( p_sys->p_cmd )
{
free( p_sys->p_cmd ); free( p_sys->p_cmd );
}
p_sys->i_cmd = i_data; p_sys->i_cmd = i_data;
p_sys->p_cmd = malloc( i_data ); p_sys->p_cmd = malloc( i_data );
memcpy( p_sys->p_cmd, p_data, i_data ); memcpy( p_sys->p_cmd, p_data, i_data );
......
...@@ -826,7 +826,6 @@ static int Open( vlc_object_t * p_this ) ...@@ -826,7 +826,6 @@ static int Open( vlc_object_t * p_this )
if( psz_device ) if( psz_device )
{ {
if( p_sys->psz_videodev )
free( p_sys->psz_videodev ); free( p_sys->psz_videodev );
p_sys->psz_videodev = psz_device; p_sys->psz_videodev = psz_device;
} }
...@@ -1061,9 +1060,7 @@ static void Close( vlc_object_t * p_this ) ...@@ -1061,9 +1060,7 @@ static void Close( vlc_object_t * p_this )
close( p_sys->i_fd ); close( p_sys->i_fd );
if ( p_sys->i_radio_fd != -1 ) if ( p_sys->i_radio_fd != -1 )
close( p_sys->i_radio_fd ); close( p_sys->i_radio_fd );
if ( p_sys->psz_videodev )
free( p_sys->psz_videodev ); free( p_sys->psz_videodev );
if ( p_sys->psz_radiodev )
free( p_sys->psz_radiodev ); free( p_sys->psz_radiodev );
free( p_sys ); free( p_sys );
} }
......
...@@ -106,8 +106,8 @@ static void asmrp_dispose (asmrp_t *p) { ...@@ -106,8 +106,8 @@ static void asmrp_dispose (asmrp_t *p) {
for (i=0; i<p->sym_tab_num; i++) for (i=0; i<p->sym_tab_num; i++)
free (p->sym_tab[i].id); free (p->sym_tab[i].id);
if (p->buf) free (p->buf); free( p->buf );
free (p); free( p );
} }
static void asmrp_getch (asmrp_t *p) { static void asmrp_getch (asmrp_t *p) {
......
...@@ -214,11 +214,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -214,11 +214,8 @@ static int Open( vlc_object_t *p_this )
psz_out, psz_in ); psz_out, psz_in );
} }
} }
if( pp_in_ports )
{
free( pp_in_ports ); free( pp_in_ports );
} }
}
msg_Dbg( p_aout, "JACK audio output initialized (%d channels, buffer " msg_Dbg( p_aout, "JACK audio output initialized (%d channels, buffer "
"size=%d, rate=%d)", p_sys->i_channels, "size=%d, rate=%d)", p_sys->i_channels,
...@@ -233,14 +230,8 @@ error_out: ...@@ -233,14 +230,8 @@ error_out:
jack_deactivate( p_sys->p_jack_client ); jack_deactivate( p_sys->p_jack_client );
jack_client_close( p_sys->p_jack_client ); jack_client_close( p_sys->p_jack_client );
} }
if( p_sys->p_jack_ports )
{
free( p_sys->p_jack_ports ); free( p_sys->p_jack_ports );
}
if( p_sys->p_jack_buffers )
{
free( p_sys->p_jack_buffers ); free( p_sys->p_jack_buffers );
}
free( p_sys ); free( p_sys );
} }
return status; return status;
......
...@@ -334,7 +334,6 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h ...@@ -334,7 +334,6 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
{ {
msg_Warn( p_dec, "can't get spu buffer" ); msg_Warn( p_dec, "can't get spu buffer" );
free( psz_subtitle ); free( psz_subtitle );
if( psz_html )
free( psz_html ); free( psz_html );
return NULL; return NULL;
} }
...@@ -352,7 +351,6 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h ...@@ -352,7 +351,6 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
{ {
msg_Err( p_dec, "cannot allocate SPU region" ); msg_Err( p_dec, "cannot allocate SPU region" );
free( psz_subtitle ); free( psz_subtitle );
if( psz_html )
free( psz_html ); free( psz_html );
p_dec->pf_spu_buffer_del( p_dec, p_spu ); p_dec->pf_spu_buffer_del( p_dec, p_spu );
return NULL; return NULL;
......
...@@ -421,14 +421,14 @@ xtag_free (XTag * xtag) ...@@ -421,14 +421,14 @@ xtag_free (XTag * xtag)
if (xtag == NULL) return NULL; if (xtag == NULL) return NULL;
if (xtag->name) free (xtag->name); free( xtag->name );
if (xtag->pcdata) free (xtag->pcdata); free( xtag->pcdata );
for (l = xtag->attributes; l; l = l->next) { for (l = xtag->attributes; l; l = l->next) {
if ((attr = (XAttribute *)l->data) != NULL) { if ((attr = (XAttribute *)l->data) != NULL) {
if (attr->name) free (attr->name); free( attr->name );
if (attr->value) free (attr->value); free( attr->value );
free (attr); free( attr );
} }
} }
xlist_free (xtag->attributes); xlist_free (xtag->attributes);
......
...@@ -434,7 +434,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -434,7 +434,7 @@ static void Close( vlc_object_t *p_this )
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
faacDecClose( p_sys->hfaad ); faacDecClose( p_sys->hfaad );
if( p_sys->p_buffer ) free( p_sys->p_buffer ); free( p_sys->p_buffer );
free( p_sys ); free( p_sys );
} }
......
...@@ -225,7 +225,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -225,7 +225,7 @@ static int OpenDecoder( vlc_object_t *p_this )
} }
msg_Dbg( p_dec, "file %s loaded successfully", psz_file ); msg_Dbg( p_dec, "file %s loaded successfully", psz_file );
if ( psz_file ) free( psz_file ); free( psz_file );
if ( b_keep_ar ) if ( b_keep_ar )
{ {
...@@ -304,7 +304,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -304,7 +304,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_handler = image_HandlerCreate( p_dec ); p_handler = image_HandlerCreate( p_dec );
p_image = image_Filter( p_handler, p_old, &fmt_out, val.psz_string ); p_image = image_Filter( p_handler, p_old, &fmt_out, val.psz_string );
image_HandlerDelete( p_handler ); image_HandlerDelete( p_handler );
if ( val.psz_string != NULL ) free( val.psz_string ); free( val.psz_string );
if ( p_image == NULL ) if ( p_image == NULL )
{ {
......
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