Commit d632dbed authored by Anthony Loiseau's avatar Anthony Loiseau Committed by Rémi Duraffort

cosmetic: remove nullity test on free() and delete

Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent 8bcb2f3c
...@@ -48,8 +48,8 @@ static char *CDDAFormatMRL( const access_t *p_access, track_t i_track ); ...@@ -48,8 +48,8 @@ static char *CDDAFormatMRL( const access_t *p_access, track_t i_track );
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
#define free_and_dup(var, val) \ #define free_and_dup(var, val) \
if (var) free(var); \ free( var ); \
if (val) var=strdup(val); if (val) var = strdup( val );
/* Saves CDDB information about CD-DA via libcddb. */ /* Saves CDDB information about CD-DA via libcddb. */
......
...@@ -222,7 +222,7 @@ static int InitVideo(decoder_t *p_dec) ...@@ -222,7 +222,7 @@ static int InitVideo(decoder_t *p_dec)
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if (p_sys->plane) free(p_sys->plane); free( p_sys->plane );
p_sys->plane = malloc (p_dec->fmt_in.video.i_width*p_dec->fmt_in.video.i_height*3/2 + 1024 ); p_sys->plane = malloc (p_dec->fmt_in.video.i_width*p_dec->fmt_in.video.i_height*3/2 + 1024 );
if (NULL == p_sys->plane) if (NULL == p_sys->plane)
{ {
...@@ -419,11 +419,8 @@ static void Close( vlc_object_t *p_this ) ...@@ -419,11 +419,8 @@ static void Close( vlc_object_t *p_this )
#endif #endif
p_sys->rv_handle=NULL; p_sys->rv_handle=NULL;
if (p_sys->plane) free( p_sys->plane );
{
free(p_sys->plane);
p_sys->plane = NULL; p_sys->plane = NULL;
}
msg_Dbg( p_dec, "FreeLibrary ok." ); msg_Dbg( p_dec, "FreeLibrary ok." );
#ifdef LOADER #ifdef LOADER
......
...@@ -261,7 +261,6 @@ static aout_buffer_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block ) ...@@ -261,7 +261,6 @@ static aout_buffer_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
/* worst case */ /* worst case */
size_t i_buffer = BLOCK_MAX_SIZE * MAX_CHANNELS * p_sys->wmadec.nb_frames; size_t i_buffer = BLOCK_MAX_SIZE * MAX_CHANNELS * p_sys->wmadec.nb_frames;
if( p_sys->p_output )
free( p_sys->p_output ); free( p_sys->p_output );
p_sys->p_output = malloc(i_buffer * sizeof(int32_t) ); p_sys->p_output = malloc(i_buffer * sizeof(int32_t) );
p_sys->p_samples = (int8_t*)p_sys->p_output; p_sys->p_samples = (int8_t*)p_sys->p_output;
......
...@@ -641,7 +641,6 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars, ...@@ -641,7 +641,6 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
if( !b_error ) if( !b_error )
var_Set( p_object, psz_variable, val ); var_Set( p_object, psz_variable, val );
if( psz_value != NULL )
free( psz_value ); free( psz_value );
} }
else else
...@@ -811,7 +810,6 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars, ...@@ -811,7 +810,6 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
} }
i_result = config_SaveConfigFile( p_intf, psz_module ); i_result = config_SaveConfigFile( p_intf, psz_module );
if( psz_module != NULL )
free( psz_module ); free( psz_module );
SSPushN( st, i_result ); SSPushN( st, i_result );
} }
......
...@@ -306,7 +306,6 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m ) ...@@ -306,7 +306,6 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
{ {
KaxTrackLanguage &lang = *(KaxTrackLanguage*)l; KaxTrackLanguage &lang = *(KaxTrackLanguage*)l;
if ( tk->fmt.psz_language != NULL )
free( tk->fmt.psz_language ); free( tk->fmt.psz_language );
tk->fmt.psz_language = strdup( string( lang ).c_str() ); tk->fmt.psz_language = strdup( string( lang ).c_str() );
msg_Dbg( &sys.demuxer, msg_Dbg( &sys.demuxer,
......
...@@ -893,7 +893,6 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf ) ...@@ -893,7 +893,6 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
{ {
/* Delete old popup if there is one */ /* Delete old popup if there is one */
if( p_intf->p_sys->p_popup_menu )
delete p_intf->p_sys->p_popup_menu; delete p_intf->p_sys->p_popup_menu;
if( !show ) if( !show )
......
...@@ -67,11 +67,8 @@ AsyncQueue *AsyncQueue::instance( intf_thread_t *pIntf ) ...@@ -67,11 +67,8 @@ AsyncQueue *AsyncQueue::instance( intf_thread_t *pIntf )
void AsyncQueue::destroy( intf_thread_t *pIntf ) void AsyncQueue::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_queue )
{
delete pIntf->p_sys->p_queue; delete pIntf->p_sys->p_queue;
pIntf->p_sys->p_queue = NULL; pIntf->p_sys->p_queue = NULL;
}
} }
......
...@@ -72,11 +72,8 @@ OSLoop *MacOSXLoop::instance( intf_thread_t *pIntf ) ...@@ -72,11 +72,8 @@ OSLoop *MacOSXLoop::instance( intf_thread_t *pIntf )
void MacOSXLoop::destroy( intf_thread_t *pIntf ) void MacOSXLoop::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_osLoop )
{
delete pIntf->p_sys->p_osLoop; delete pIntf->p_sys->p_osLoop;
pIntf->p_sys->p_osLoop = NULL; pIntf->p_sys->p_osLoop = NULL;
}
} }
......
...@@ -141,11 +141,8 @@ Interpreter *Interpreter::instance( intf_thread_t *pIntf ) ...@@ -141,11 +141,8 @@ Interpreter *Interpreter::instance( intf_thread_t *pIntf )
void Interpreter::destroy( intf_thread_t *pIntf ) void Interpreter::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_interpreter )
{
delete pIntf->p_sys->p_interpreter; delete pIntf->p_sys->p_interpreter;
pIntf->p_sys->p_interpreter = NULL; pIntf->p_sys->p_interpreter = NULL;
}
} }
......
...@@ -147,11 +147,8 @@ Dialogs *Dialogs::instance( intf_thread_t *pIntf ) ...@@ -147,11 +147,8 @@ Dialogs *Dialogs::instance( intf_thread_t *pIntf )
void Dialogs::destroy( intf_thread_t *pIntf ) void Dialogs::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_dialogs )
{
delete pIntf->p_sys->p_dialogs; delete pIntf->p_sys->p_dialogs;
pIntf->p_sys->p_dialogs = NULL; pIntf->p_sys->p_dialogs = NULL;
}
} }
......
...@@ -52,11 +52,8 @@ Logger *Logger::instance( intf_thread_t *pIntf ) ...@@ -52,11 +52,8 @@ Logger *Logger::instance( intf_thread_t *pIntf )
void Logger::destroy( intf_thread_t *pIntf ) void Logger::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_logger )
{
delete pIntf->p_sys->p_logger; delete pIntf->p_sys->p_logger;
pIntf->p_sys->p_logger = NULL; pIntf->p_sys->p_logger = NULL;
}
} }
......
...@@ -64,10 +64,7 @@ OSFactory *OSFactory::instance( intf_thread_t *pIntf ) ...@@ -64,10 +64,7 @@ OSFactory *OSFactory::instance( intf_thread_t *pIntf )
void OSFactory::destroy( intf_thread_t *pIntf ) void OSFactory::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_osFactory )
{
delete pIntf->p_sys->p_osFactory; delete pIntf->p_sys->p_osFactory;
pIntf->p_sys->p_osFactory = NULL; pIntf->p_sys->p_osFactory = NULL;
}
} }
...@@ -49,11 +49,8 @@ ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf ) ...@@ -49,11 +49,8 @@ ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf )
void ThemeRepository::destroy( intf_thread_t *pIntf ) void ThemeRepository::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_repository )
{
delete pIntf->p_sys->p_repository; delete pIntf->p_sys->p_repository;
pIntf->p_sys->p_repository = NULL; pIntf->p_sys->p_repository = NULL;
}
} }
......
...@@ -74,11 +74,8 @@ VarManager *VarManager::instance( intf_thread_t *pIntf ) ...@@ -74,11 +74,8 @@ VarManager *VarManager::instance( intf_thread_t *pIntf )
void VarManager::destroy( intf_thread_t *pIntf ) void VarManager::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_varManager )
{
delete pIntf->p_sys->p_varManager; delete pIntf->p_sys->p_varManager;
pIntf->p_sys->p_varManager = NULL; pIntf->p_sys->p_varManager = NULL;
}
} }
......
...@@ -65,11 +65,8 @@ VlcProc *VlcProc::instance( intf_thread_t *pIntf ) ...@@ -65,11 +65,8 @@ VlcProc *VlcProc::instance( intf_thread_t *pIntf )
void VlcProc::destroy( intf_thread_t *pIntf ) void VlcProc::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_vlcProc )
{
delete pIntf->p_sys->p_vlcProc; delete pIntf->p_sys->p_vlcProc;
pIntf->p_sys->p_vlcProc = NULL; pIntf->p_sys->p_vlcProc = NULL;
}
} }
......
...@@ -50,11 +50,8 @@ VoutManager *VoutManager::instance( intf_thread_t *pIntf ) ...@@ -50,11 +50,8 @@ VoutManager *VoutManager::instance( intf_thread_t *pIntf )
void VoutManager::destroy( intf_thread_t *pIntf ) void VoutManager::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_voutManager )
{
delete pIntf->p_sys->p_voutManager; delete pIntf->p_sys->p_voutManager;
pIntf->p_sys->p_voutManager = NULL; pIntf->p_sys->p_voutManager = NULL;
}
} }
......
...@@ -107,11 +107,8 @@ OSLoop *Win32Loop::instance( intf_thread_t *pIntf ) ...@@ -107,11 +107,8 @@ OSLoop *Win32Loop::instance( intf_thread_t *pIntf )
void Win32Loop::destroy( intf_thread_t *pIntf ) void Win32Loop::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_osLoop )
{
delete pIntf->p_sys->p_osLoop; delete pIntf->p_sys->p_osLoop;
pIntf->p_sys->p_osLoop = NULL; pIntf->p_sys->p_osLoop = NULL;
}
} }
......
...@@ -100,11 +100,8 @@ OSLoop *X11Loop::instance( intf_thread_t *pIntf, X11Display &rDisplay ) ...@@ -100,11 +100,8 @@ OSLoop *X11Loop::instance( intf_thread_t *pIntf, X11Display &rDisplay )
void X11Loop::destroy( intf_thread_t *pIntf ) void X11Loop::destroy( intf_thread_t *pIntf )
{ {
if( pIntf->p_sys->p_osLoop )
{
delete pIntf->p_sys->p_osLoop; delete pIntf->p_sys->p_osLoop;
pIntf->p_sys->p_osLoop = NULL; pIntf->p_sys->p_osLoop = NULL;
}
} }
......
...@@ -922,7 +922,6 @@ static int dirac_InspectDataUnit( decoder_t *p_dec, block_t **pp_block, block_t ...@@ -922,7 +922,6 @@ static int dirac_InspectDataUnit( decoder_t *p_dec, block_t **pp_block, block_t
* - required for ogg muxing * - required for ogg muxing
* - useful for error checking * - useful for error checking
* - it isn't allowed to change until an eos */ * - it isn't allowed to change until an eos */
if( p_es->p_extra )
free( p_es->p_extra ); free( p_es->p_extra );
p_es->p_extra = calloc( 1, p_block->i_buffer + 13 ); p_es->p_extra = calloc( 1, p_block->i_buffer + 13 );
if( !p_es->p_extra ) if( !p_es->p_extra )
......
...@@ -67,8 +67,7 @@ CAtmoConfig::~CAtmoConfig() { ...@@ -67,8 +67,7 @@ CAtmoConfig::~CAtmoConfig() {
// and finally cleanup... // and finally cleanup...
clearAllChannelMappings(); clearAllChannelMappings();
#if !defined (WIN32) #if !defined (WIN32)
if(m_devicename) free( m_devicename );
free(m_devicename);
#endif #endif
} }
...@@ -234,7 +233,6 @@ void CAtmoConfig::AddChannelAssignment(tChannelAssignment *ta) { ...@@ -234,7 +233,6 @@ void CAtmoConfig::AddChannelAssignment(tChannelAssignment *ta) {
} }
void CAtmoConfig::SetChannelAssignment(int index, tChannelAssignment *ta) { void CAtmoConfig::SetChannelAssignment(int index, tChannelAssignment *ta) {
if(m_ChannelAssignments[index]!=NULL)
delete m_ChannelAssignments[index]; delete m_ChannelAssignments[index];
m_ChannelAssignments[index] = ta; m_ChannelAssignments[index] = ta;
} }
......
...@@ -42,8 +42,7 @@ CAtmoExternalCaptureInput::CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData) ...@@ -42,8 +42,7 @@ CAtmoExternalCaptureInput::CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData)
CAtmoExternalCaptureInput::~CAtmoExternalCaptureInput(void) CAtmoExternalCaptureInput::~CAtmoExternalCaptureInput(void)
{ {
/* if there is still an unprocessed bufferpicture do kill it */ /* if there is still an unprocessed bufferpicture do kill it */
if(m_pCurrentFramePixels != NULL) free( m_pCurrentFramePixels );
free(m_pCurrentFramePixels);
#if defined(_ATMO_VLC_PLUGIN_) #if defined(_ATMO_VLC_PLUGIN_)
vlc_cond_destroy( &m_WakeupCond ); vlc_cond_destroy( &m_WakeupCond );
......
...@@ -805,8 +805,7 @@ static void AtmoCreateTransferBuffers(filter_t *p_filter, ...@@ -805,8 +805,7 @@ static void AtmoCreateTransferBuffers(filter_t *p_filter,
we need a buffer where the image is stored (only for transfer we need a buffer where the image is stored (only for transfer
to the processing thread) to the processing thread)
*/ */
if(p_sys->p_atmo_transfer_buffer) free( p_sys->p_atmo_transfer_buffer );
free(p_sys->p_atmo_transfer_buffer);
p_sys->p_atmo_transfer_buffer = (uint8_t *)malloc(bytePerPixel * p_sys->p_atmo_transfer_buffer = (uint8_t *)malloc(bytePerPixel *
width * height); width * height);
......
...@@ -133,9 +133,7 @@ static void CloseFilter( vlc_object_t *p_this ) ...@@ -133,9 +133,7 @@ static void CloseFilter( vlc_object_t *p_this )
if( p_filter->p_sys->p_storage ) if( p_filter->p_sys->p_storage )
cvReleaseMemStorage( &p_filter->p_sys->p_storage ); cvReleaseMemStorage( &p_filter->p_sys->p_storage );
if (NULL != p_filter->p_sys->event_info.p_region) free( p_filter->p_sys->event_info.p_region );
free(p_filter->p_sys->event_info.p_region);
free( p_sys ); free( p_sys );
var_Destroy( p_filter->p_libvlc, VIDEO_FILTER_EVENT_VARIABLE); var_Destroy( p_filter->p_libvlc, VIDEO_FILTER_EVENT_VARIABLE);
...@@ -199,11 +197,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -199,11 +197,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if (faces && (faces->total > 0)) if (faces && (faces->total > 0))
{ {
//msg_Dbg( p_filter, "Found %d face(s)", faces->total ); //msg_Dbg( p_filter, "Found %d face(s)", faces->total );
if (NULL != p_filter->p_sys->event_info.p_region) free( p_filter->p_sys->event_info.p_region );
{
free(p_filter->p_sys->event_info.p_region);
p_filter->p_sys->event_info.p_region = NULL; p_filter->p_sys->event_info.p_region = NULL;
}
if( NULL == ( p_filter->p_sys->event_info.p_region = if( NULL == ( p_filter->p_sys->event_info.p_region =
(video_filter_region_info_t *)malloc(faces->total*sizeof(video_filter_region_info_t)))) (video_filter_region_info_t *)malloc(faces->total*sizeof(video_filter_region_info_t))))
{ {
......
...@@ -197,11 +197,8 @@ static void Close ( vlc_object_t *p_this ) ...@@ -197,11 +197,8 @@ static void Close ( vlc_object_t *p_this )
module_unneed( p_vout, p_vout->p_sys->p_qte_main ); module_unneed( p_vout, p_vout->p_sys->p_qte_main );
#endif #endif
if( p_vout->p_sys )
{
free( p_vout->p_sys ); free( p_vout->p_sys );
p_vout->p_sys = NULL; p_vout->p_sys = NULL;
}
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -771,7 +771,6 @@ int checkXvMCCap( vout_thread_t *p_vout ) ...@@ -771,7 +771,6 @@ int checkXvMCCap( vout_thread_t *p_vout )
} }
else else
{ {
if( p_vout->p_sys->xvmc_cap )
free( p_vout->p_sys->xvmc_cap ); free( p_vout->p_sys->xvmc_cap );
p_vout->p_sys->xvmc_cap = NULL; p_vout->p_sys->xvmc_cap = NULL;
msg_Err( p_vout, "use of direct XvMC context on a remote display failed" msg_Err( p_vout, "use of direct XvMC context on a remote display failed"
...@@ -1012,7 +1011,6 @@ void xxmc_dispose_context( vout_thread_t *p_vout ) ...@@ -1012,7 +1011,6 @@ void xxmc_dispose_context( vout_thread_t *p_vout )
} }
msg_Dbg( p_vout, "freeing up XvMC surfaces and subpictures" ); msg_Dbg( p_vout, "freeing up XvMC surfaces and subpictures" );
if( p_vout->p_sys->xvmc_palette )
free( p_vout->p_sys->xvmc_palette ); free( p_vout->p_sys->xvmc_palette );
dispose_xx44_palette( &p_vout->p_sys->palette ); dispose_xx44_palette( &p_vout->p_sys->palette );
xxmc_xvmc_destroy_subpictures( p_vout ); xxmc_xvmc_destroy_subpictures( p_vout );
......
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