]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/directx.c
Remove useless test before a free().
[vlc] / modules / video_output / msw / directx.c
index ac3585fde1ccfaa9deeaf8564a30eb5a0d3b646a..82c1da11abc4c84b41a9185117ab818d6c717c95 100644 (file)
  *****************************************************************************/
 #include <errno.h>                                                 /* ENOMEM */
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include <vlc_interface.h>
 #include <vlc_playlist.h>
@@ -277,7 +281,7 @@ static int OpenVideo( vlc_object_t *p_this )
                            E_(EventThread), 0, 1 ) )
     {
         msg_Err( p_vout, "cannot create Vout EventThread" );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
         p_vout->p_sys->p_event = NULL;
         goto error;
     }
@@ -501,7 +505,7 @@ static void CloseVideo( vlc_object_t *p_this )
         }
 
         vlc_thread_join( p_vout->p_sys->p_event );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
     }
 
     vlc_mutex_destroy( &p_vout->p_sys->lock );
@@ -523,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;
 }
 
 /*****************************************************************************
@@ -794,10 +795,10 @@ static void FirstDisplay( vout_thread_t *p_vout, picture_t *p_pic )
                       (LONG)CreateSolidBrush( p_vout->p_sys->i_rgb_colorkey ) );
     }
     /*
-    ** Video window is initially hidden, show it now since we got a 
+    ** Video window is initially hidden, show it now since we got a
     ** picture to show.
     */
-    SetWindowPos( p_vout->p_sys->hvideownd, NULL, 0, 0, 0, 0, 
+    SetWindowPos( p_vout->p_sys->hvideownd, NULL, 0, 0, 0, 0,
         SWP_ASYNCWINDOWPOS|
         SWP_FRAMECHANGED|
         SWP_SHOWWINDOW|
@@ -833,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 )
         {
@@ -859,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 */
         }
 
@@ -1324,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;
 }
@@ -2032,7 +2030,7 @@ void SwitchWallpaperMode( vout_thread_t *p_vout, vlc_bool_t b_on )
     }
 
     /* Update desktop */
-    InvalidateRect( hwnd, NULL, TRUE );            
+    InvalidateRect( hwnd, NULL, TRUE );
     UpdateWindow( hwnd );
 }