[vlc-devel] commit: Fix CID 107: dereference pointer before NULL check. ( Jean-Paul Saman )

git version control git at videolan.org
Sat May 31 15:22:35 CEST 2008


vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Sat May 31 15:23:39 2008 +0200| [fdee36bba38e0471580b5196f4a59dcb374ee11b]

Fix CID 107: dereference pointer before NULL check.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fdee36bba38e0471580b5196f4a59dcb374ee11b
---

 modules/video_filter/osdmenu.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/video_filter/osdmenu.c b/modules/video_filter/osdmenu.c
index 65da3a7..a99a797 100644
--- a/modules/video_filter/osdmenu.c
+++ b/modules/video_filter/osdmenu.c
@@ -300,12 +300,15 @@ static void DestroyFilter( vlc_object_t *p_this )
     var_DelCallback( p_filter, OSD_CFG "update", OSDMenuCallback, p_sys );
     var_DelCallback( p_filter, OSD_CFG "alpha", OSDMenuCallback, p_sys );
 
-    var_DelCallback( p_sys->p_menu, "osd-menu-update",
-                     OSDMenuUpdateEvent, p_filter );
-    var_DelCallback( p_sys->p_menu, "osd-menu-visible",
-                     OSDMenuVisibleEvent, p_filter );
+    if( p_sys )
+    {
+        var_DelCallback( p_sys->p_menu, "osd-menu-update",
+                         OSDMenuUpdateEvent, p_filter );
+        var_DelCallback( p_sys->p_menu, "osd-menu-visible",
+                         OSDMenuVisibleEvent, p_filter );
+    }
 
-    if( p_sys->p_vout )
+    if( p_sys && p_sys->p_vout )
     {
         var_DelCallback( p_sys->p_vout, "mouse-x",
                         MouseEvent, p_sys );
@@ -327,10 +330,13 @@ static void DestroyFilter( vlc_object_t *p_this )
     var_Destroy( p_this, OSD_CFG "update" );
     var_Destroy( p_this, OSD_CFG "alpha" );
 
-    osd_MenuDelete( p_filter, p_sys->p_menu );
+    if( p_sys )
+    {
+        osd_MenuDelete( p_filter, p_sys->p_menu );
 
-    free( p_sys->psz_file );
-    free( p_sys );
+        free( p_sys->psz_file );
+        free( p_sys );
+    }
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list