Commit 0f00164e authored by Rémi Duraffort's avatar Rémi Duraffort

Remove useless test before a free().

parent 1e83ef82
...@@ -138,7 +138,7 @@ class CAtmoConfig { ...@@ -138,7 +138,7 @@ class CAtmoConfig {
#if defined(_ATMO_VLC_PLUGIN_) #if defined(_ATMO_VLC_PLUGIN_)
char *getSerialDevice() { return m_devicename; } char *getSerialDevice() { return m_devicename; }
void setSerialDevice(char *newdevice) { if(m_devicename) free(m_devicename); if(newdevice) m_devicename = strdup(newdevice); else m_devicename = NULL; } void setSerialDevice(char *newdevice) { free( m_devicename ); if(newdevice) m_devicename = strdup(newdevice); else m_devicename = NULL; }
#else #else
int getComport() { return m_Comport; } int getComport() { return m_Comport; }
void setComport(int value) { m_Comport = value; } void setComport(int value) { m_Comport = value; }
......
...@@ -264,7 +264,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -264,7 +264,7 @@ static int Init( vout_thread_t *p_vout )
msg_Err( p_vout, "failed to clone %i vout threads", msg_Err( p_vout, "failed to clone %i vout threads",
p_vout->p_sys->i_clones ); p_vout->p_sys->i_clones );
p_vout->p_sys->i_clones = i_vout; p_vout->p_sys->i_clones = i_vout;
if( psz_default_vout ) free( psz_default_vout ); free( psz_default_vout );
RemoveAllVout( p_vout ); RemoveAllVout( p_vout );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -272,7 +272,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -272,7 +272,7 @@ static int Init( vout_thread_t *p_vout )
ADD_CALLBACKS( p_vout->p_sys->pp_vout[ i_vout ], SendEvents ); ADD_CALLBACKS( p_vout->p_sys->pp_vout[ i_vout ], SendEvents );
} }
if( psz_default_vout ) free( psz_default_vout ); free( psz_default_vout );
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
ADD_PARENT_CALLBACKS( SendEventsToChild ); ADD_PARENT_CALLBACKS( SendEventsToChild );
......
...@@ -736,8 +736,8 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic, ...@@ -736,8 +736,8 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
} }
} }
if( p_hough ) free( p_hough ); free( p_hough );
if( p_smooth ) free( p_smooth ); free( p_smooth );
} }
#undef p_pre_hough #undef p_pre_hough
......
...@@ -238,8 +238,8 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -238,8 +238,8 @@ static void DestroyFilter( vlc_object_t *p_this )
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
if( p_sys->p_style ) free( p_sys->p_style ); free( p_sys->p_style );
if( p_sys->psz_marquee ) free( p_sys->psz_marquee ); free( p_sys->psz_marquee );
/* Delete the marquee variables */ /* Delete the marquee variables */
#define DEL_VAR(var) \ #define DEL_VAR(var) \
...@@ -341,7 +341,7 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var, ...@@ -341,7 +341,7 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
if( !strncmp( psz_var, "marq-marquee", 7 ) ) if( !strncmp( psz_var, "marq-marquee", 7 ) )
{ {
if( p_sys->psz_marquee ) free( p_sys->psz_marquee ); free( p_sys->psz_marquee );
p_sys->psz_marquee = strdup( newval.psz_string ); p_sys->psz_marquee = strdup( newval.psz_string );
} }
else if ( !strncmp( psz_var, "marq-x", 6 ) ) else if ( !strncmp( psz_var, "marq-x", 6 ) )
......
...@@ -281,8 +281,8 @@ error: ...@@ -281,8 +281,8 @@ error:
osd_MenuDelete( p_this, p_sys->p_menu ); osd_MenuDelete( p_this, p_sys->p_menu );
p_sys->p_menu = NULL; p_sys->p_menu = NULL;
if( p_sys->psz_file ) free( p_sys->psz_file ); free( p_sys->psz_file );
if( p_sys ) free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -328,8 +328,8 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -328,8 +328,8 @@ static void DestroyFilter( vlc_object_t *p_this )
osd_MenuDelete( p_filter, p_sys->p_menu ); osd_MenuDelete( p_filter, p_sys->p_menu );
if( p_sys->psz_file ) free( p_sys->psz_file ); free( p_sys->psz_file );
if( p_sys ) free( p_sys ); free( p_sys );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -348,8 +348,8 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -348,8 +348,8 @@ static void DestroyFilter( vlc_object_t *p_this )
vlc_mutex_lock( &p_sys->lock ); vlc_mutex_lock( &p_sys->lock );
if( p_sys->p_style ) free( p_sys->p_style ); free( p_sys->p_style );
if( p_sys->psz_marquee ) free( p_sys->psz_marquee ); free( p_sys->psz_marquee );
free( p_sys->psz_urls ); free( p_sys->psz_urls );
FreeRSS( p_filter ); FreeRSS( p_filter );
vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_unlock( &p_sys->lock );
...@@ -740,11 +740,8 @@ static int FetchRSS( filter_t *p_filter) ...@@ -740,11 +740,8 @@ static int FetchRSS( filter_t *p_filter)
return 1; return 1;
case XML_READER_STARTELEM: case XML_READER_STARTELEM:
if( psz_eltname ) free( psz_eltname );
{ psz_eltname = NULL;
free( psz_eltname );
psz_eltname = NULL;
}
psz_eltname = xml_ReaderName( p_xml_reader ); psz_eltname = xml_ReaderName( p_xml_reader );
if( !psz_eltname ) if( !psz_eltname )
{ {
...@@ -816,18 +813,15 @@ static int FetchRSS( filter_t *p_filter) ...@@ -816,18 +813,15 @@ static int FetchRSS( filter_t *p_filter)
} }
else else
{ {
if( psz_href ) free( psz_href ); free( psz_href );
} }
if( psz_rel ) free( psz_rel ); free( psz_rel );
} }
break; break;
case XML_READER_ENDELEM: case XML_READER_ENDELEM:
if( psz_eltname ) free( psz_eltname );
{ psz_eltname = NULL;
free( psz_eltname );
psz_eltname = NULL;
}
psz_eltname = xml_ReaderName( p_xml_reader ); psz_eltname = xml_ReaderName( p_xml_reader );
if( !psz_eltname ) if( !psz_eltname )
{ {
......
...@@ -255,8 +255,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -255,8 +255,7 @@ static void End( vout_thread_t *p_vout )
{ {
vout_sys_t *p_sys = p_vout->p_sys; vout_sys_t *p_sys = p_vout->p_sys;
if( p_sys->p_pixels ) free( p_sys->p_pixels );
free( p_sys->p_pixels );
} }
static void Destroy( vlc_object_t *p_this ) static void Destroy( vlc_object_t *p_this )
...@@ -265,7 +264,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -265,7 +264,7 @@ static void Destroy( vlc_object_t *p_this )
vout_sys_t *p_sys = p_vout->p_sys; vout_sys_t *p_sys = p_vout->p_sys;
CloseDisplay( p_vout ); CloseDisplay( p_vout );
if( p_sys ) free( p_sys ); free( p_sys );
p_sys = NULL; p_sys = NULL;
} }
......
...@@ -395,7 +395,7 @@ static int OpenDisplay( vout_thread_t *p_vout ) ...@@ -395,7 +395,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
psz_display = config_GetPsz( p_vout, "ggi_display" ); psz_display = config_GetPsz( p_vout, "ggi_display" );
p_vout->p_sys->p_display = ggiOpen( psz_display, NULL ); p_vout->p_sys->p_display = ggiOpen( psz_display, NULL );
if( psz_display ) free( psz_display ); free( psz_display );
if( p_vout->p_sys->p_display == NULL ) if( p_vout->p_sys->p_display == NULL )
{ {
......
...@@ -527,11 +527,8 @@ static void CloseVideo( vlc_object_t *p_this ) ...@@ -527,11 +527,8 @@ static void CloseVideo( vlc_object_t *p_this )
p_vout->p_sys->i_spi_screensavetimeout, NULL, 0); p_vout->p_sys->i_spi_screensavetimeout, NULL, 0);
} }
if( p_vout->p_sys ) free( p_vout->p_sys );
{ p_vout->p_sys = NULL;
free( p_vout->p_sys );
p_vout->p_sys = NULL;
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -837,7 +834,7 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc, ...@@ -837,7 +834,7 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
if( ( !device.psz_string || !*device.psz_string ) && if( ( !device.psz_string || !*device.psz_string ) &&
hmon == p_vout->p_sys->hmonitor ) hmon == p_vout->p_sys->hmonitor )
{ {
if( device.psz_string ) free( device.psz_string ); free( device.psz_string );
} }
else if( strcmp( psz_drivername, device.psz_string ) == 0 ) else if( strcmp( psz_drivername, device.psz_string ) == 0 )
{ {
...@@ -863,11 +860,11 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc, ...@@ -863,11 +860,11 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
} }
p_vout->p_sys->hmonitor = hmon; p_vout->p_sys->hmonitor = hmon;
if( device.psz_string ) free( device.psz_string ); free( device.psz_string );
} }
else else
{ {
if( device.psz_string ) free( device.psz_string ); free( device.psz_string );
return TRUE; /* Keep enumerating */ return TRUE; /* Keep enumerating */
} }
...@@ -1328,11 +1325,8 @@ static void DirectXCloseDDraw( vout_thread_t *p_vout ) ...@@ -1328,11 +1325,8 @@ static void DirectXCloseDDraw( vout_thread_t *p_vout )
p_vout->p_sys->hddraw_dll = NULL; p_vout->p_sys->hddraw_dll = NULL;
} }
if( p_vout->p_sys->p_display_driver != NULL ) free( p_vout->p_sys->p_display_driver );
{ p_vout->p_sys->p_display_driver = NULL;
free( p_vout->p_sys->p_display_driver );
p_vout->p_sys->p_display_driver = NULL;
}
p_vout->p_sys->hmonitor = NULL; p_vout->p_sys->hmonitor = NULL;
} }
......
...@@ -316,7 +316,7 @@ void E_(EventThread)( event_thread_t *p_event ) ...@@ -316,7 +316,7 @@ void E_(EventThread)( event_thread_t *p_event )
var_Get( p_event->p_vout, "video-title", &val ); var_Get( p_event->p_vout, "video-title", &val );
if( !val.psz_string || !*val.psz_string ) /* Default video title */ if( !val.psz_string || !*val.psz_string ) /* Default video title */
{ {
if( val.psz_string ) free( val.psz_string ); free( val.psz_string );
#ifdef MODULE_NAME_IS_wingdi #ifdef MODULE_NAME_IS_wingdi
val.psz_string = strdup( VOUT_TITLE " (WinGDI output)" ); val.psz_string = strdup( VOUT_TITLE " (WinGDI output)" );
......
...@@ -495,7 +495,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -495,7 +495,7 @@ static int Init( vout_thread_t *p_vout )
p_sys->i_effect = OPENGL_EFFECT_NONE; p_sys->i_effect = OPENGL_EFFECT_NONE;
#endif #endif
} }
if( val.psz_string ) free( val.psz_string ); free( val.psz_string );
if( p_sys->i_effect & ( OPENGL_EFFECT_CUBE | if( p_sys->i_effect & ( OPENGL_EFFECT_CUBE |
OPENGL_EFFECT_TRANSPARENT_CUBE ) ) OPENGL_EFFECT_TRANSPARENT_CUBE ) )
...@@ -553,8 +553,8 @@ static void End( vout_thread_t *p_vout ) ...@@ -553,8 +553,8 @@ static void End( vout_thread_t *p_vout )
/* Free the texture buffer*/ /* Free the texture buffer*/
glDeleteTextures( 2, p_sys->p_textures ); glDeleteTextures( 2, p_sys->p_textures );
if( p_sys->pp_buffer[0] ) free( p_sys->pp_buffer[0] ); free( p_sys->pp_buffer[0] );
if( p_sys->pp_buffer[1] ) free( p_sys->pp_buffer[1] ); free( p_sys->pp_buffer[1] );
if( p_sys->p_vout->pf_unlock ) if( p_sys->p_vout->pf_unlock )
{ {
......
...@@ -224,10 +224,10 @@ int E_(Activate) ( vlc_object_t *p_this ) ...@@ -224,10 +224,10 @@ int E_(Activate) ( vlc_object_t *p_this )
msg_Err( p_vout, "cannot open display %s", msg_Err( p_vout, "cannot open display %s",
XDisplayName( psz_display ) ); XDisplayName( psz_display ) );
free( p_vout->p_sys ); free( p_vout->p_sys );
if( psz_display ) free( psz_display ); free( psz_display );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if( psz_display ) free( psz_display ); free( psz_display );
/* Replace error handler so we can intercept some non-fatal errors */ /* Replace error handler so we can intercept some non-fatal errors */
XSetErrorHandler( X11ErrorHandler ); XSetErrorHandler( X11ErrorHandler );
...@@ -1698,7 +1698,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1698,7 +1698,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
XStoreName( p_vout->p_sys->p_display, XStoreName( p_vout->p_sys->p_display,
p_win->base_window, val.psz_string ); p_win->base_window, val.psz_string );
} }
if( val.psz_string ) free( val.psz_string ); free( val.psz_string );
if( !p_vout->b_fullscreen ) if( !p_vout->b_fullscreen )
{ {
......
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