Remove useless test before a free().
authorRémi Duraffort <ivoire@videolan.org>
Wed, 12 Mar 2008 10:42:46 +0000 (11:42 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 12 Mar 2008 11:07:42 +0000 (12:07 +0100)
12 files changed:
modules/video_filter/atmo/AtmoConfig.h
modules/video_filter/clone.c
modules/video_filter/gradient.c
modules/video_filter/marq.c
modules/video_filter/osdmenu.c
modules/video_filter/rss.c
modules/video_output/directfb.c
modules/video_output/ggi.c
modules/video_output/msw/directx.c
modules/video_output/msw/events.c
modules/video_output/opengl.c
modules/video_output/x11/xcommon.c

index 7d3b6d6..52c57f3 100644 (file)
@@ -138,7 +138,7 @@ class CAtmoConfig {
 
 #if defined(_ATMO_VLC_PLUGIN_)
         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
         int getComport()                    { return m_Comport; }
         void setComport(int value)          { m_Comport = value; }
index c4d3319..479ebc7 100644 (file)
@@ -264,7 +264,7 @@ static int Init( vout_thread_t *p_vout )
             msg_Err( p_vout, "failed to clone %i vout threads",
                      p_vout->p_sys->i_clones );
             p_vout->p_sys->i_clones = i_vout;
-            if( psz_default_vout ) free( psz_default_vout );
+            free( psz_default_vout );
             RemoveAllVout( p_vout );
             return VLC_EGENERIC;
         }
@@ -272,7 +272,7 @@ static int Init( vout_thread_t *p_vout )
         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 );
 
     ADD_PARENT_CALLBACKS( SendEventsToChild );
index 300fb8b..604a3ac 100644 (file)
@@ -736,8 +736,8 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
         }
     }
 
-    if( p_hough ) free( p_hough );
-    if( p_smooth ) free( p_smooth );
+    free( p_hough );
+    free( p_smooth );
 }
 #undef p_pre_hough
 
index fe806e9..619c485 100644 (file)
@@ -238,8 +238,8 @@ static void DestroyFilter( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys = p_filter->p_sys;
 
-    if( p_sys->p_style ) free( p_sys->p_style );
-    if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
+    free( p_sys->p_style );
+    free( p_sys->psz_marquee );
 
     /* Delete the marquee variables */
 #define DEL_VAR(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( p_sys->psz_marquee ) free( p_sys->psz_marquee );
+        free( p_sys->psz_marquee );
         p_sys->psz_marquee = strdup( newval.psz_string );
     }
     else if ( !strncmp( psz_var, "marq-x", 6 ) )
index 4546567..c52644a 100644 (file)
@@ -281,8 +281,8 @@ error:
 
     osd_MenuDelete( p_this, p_sys->p_menu );
     p_sys->p_menu = NULL;
-    if( p_sys->psz_file ) free( p_sys->psz_file );
-    if( p_sys ) free( p_sys );
+    free( p_sys->psz_file );
+    free( p_sys );
     return VLC_EGENERIC;
 }
 
@@ -328,8 +328,8 @@ static void DestroyFilter( vlc_object_t *p_this )
 
     osd_MenuDelete( p_filter, p_sys->p_menu );
 
-    if( p_sys->psz_file ) free( p_sys->psz_file );
-    if( p_sys ) free( p_sys );
+    free( p_sys->psz_file );
+    free( p_sys );
 }
 
 /*****************************************************************************
index 7d60b26..a43ceba 100644 (file)
@@ -348,8 +348,8 @@ static void DestroyFilter( vlc_object_t *p_this )
 
     vlc_mutex_lock( &p_sys->lock );
 
-    if( p_sys->p_style ) free( p_sys->p_style );
-    if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
+    free( p_sys->p_style );
+    free( p_sys->psz_marquee );
     free( p_sys->psz_urls );
     FreeRSS( p_filter );
     vlc_mutex_unlock( &p_sys->lock );
@@ -740,11 +740,8 @@ static int FetchRSS( filter_t *p_filter)
                     return 1;
 
                 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 );
                     if( !psz_eltname )
                     {
@@ -816,18 +813,15 @@ static int FetchRSS( filter_t *p_filter)
                         }
                         else
                         {
-                            if( psz_href ) free( psz_href );
+                            free( psz_href );
                         }
-                        if( psz_rel ) free( psz_rel );
+                        free( psz_rel );
                     }
                     break;
 
                 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 );
                     if( !psz_eltname )
                     {
index 28deb80..080b7b7 100644 (file)
@@ -255,8 +255,7 @@ static void End( vout_thread_t *p_vout )
 {
     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 )
@@ -265,7 +264,7 @@ static void Destroy( vlc_object_t *p_this )
     vout_sys_t *p_sys = p_vout->p_sys;
 
     CloseDisplay( p_vout );
-    if( p_sys ) free( p_sys );
+    free( p_sys );
     p_sys = NULL;
 }
 
index 0d697d2..dc6c140 100644 (file)
@@ -395,7 +395,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
     psz_display = config_GetPsz( p_vout, "ggi_display" );
 
     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 )
     {
index 915af9f..82c1da1 100644 (file)
@@ -527,11 +527,8 @@ static void CloseVideo( vlc_object_t *p_this )
             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,
         if( ( !device.psz_string || !*device.psz_string ) &&
             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 )
         {
@@ -863,11 +860,11 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
             }
 
             p_vout->p_sys->hmonitor = hmon;
-            if( device.psz_string ) free( device.psz_string );
+            free( device.psz_string );
         }
         else
         {
-            if( device.psz_string ) free( device.psz_string );
+            free( device.psz_string );
             return TRUE; /* Keep enumerating */
         }
 
@@ -1328,11 +1325,8 @@ static void DirectXCloseDDraw( vout_thread_t *p_vout )
         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;
 }
index 0c50caf..975519f 100644 (file)
@@ -316,7 +316,7 @@ void E_(EventThread)( event_thread_t *p_event )
             var_Get( p_event->p_vout, "video-title", &val );
             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
                 val.psz_string = strdup( VOUT_TITLE " (WinGDI output)" );
index a8835a9..a3b1ba9 100644 (file)
@@ -495,7 +495,7 @@ static int Init( vout_thread_t *p_vout )
         p_sys->i_effect = OPENGL_EFFECT_NONE;
 #endif
     }
-    if( val.psz_string ) free( val.psz_string );
+    free( val.psz_string );
 
     if( p_sys->i_effect & ( OPENGL_EFFECT_CUBE |
                 OPENGL_EFFECT_TRANSPARENT_CUBE ) )
@@ -553,8 +553,8 @@ static void End( vout_thread_t *p_vout )
 
     /* Free the texture buffer*/
     glDeleteTextures( 2, p_sys->p_textures );
-    if( 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[0] );
+    free( p_sys->pp_buffer[1] );
 
     if( p_sys->p_vout->pf_unlock )
     {
index aa1b36f..0563c19 100644 (file)
@@ -224,10 +224,10 @@ int E_(Activate) ( vlc_object_t *p_this )
         msg_Err( p_vout, "cannot open display %s",
                          XDisplayName( psz_display ) );
         free( p_vout->p_sys );
-        if( psz_display ) free( psz_display );
+        free( psz_display );
         return VLC_EGENERIC;
     }
-    if( psz_display ) free( psz_display );
+    free( psz_display );
 
     /* Replace error handler so we can intercept some non-fatal errors */
     XSetErrorHandler( X11ErrorHandler );
@@ -1698,7 +1698,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
             XStoreName( p_vout->p_sys->p_display,
                         p_win->base_window, val.psz_string );
         }
-        if( val.psz_string ) free( val.psz_string );
+        free( val.psz_string );
 
         if( !p_vout->b_fullscreen )
         {