]> git.sesse.net Git - vlc/commitdiff
libvlc_video_get_width: Don't use a potentially freed pointer.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 13 Jun 2008 13:38:23 +0000 (15:38 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 13 Jun 2008 13:38:23 +0000 (15:38 +0200)
Pointed-out-by: Lukas
src/control/video.c

index 9e0e2630603c87ed37cd1581f57e6fd8179f733c..f243333b57140acdc01164324825aef7bd49f7a0 100644 (file)
@@ -154,13 +154,16 @@ int libvlc_video_get_height( libvlc_media_player_t *p_mi,
 int libvlc_video_get_width( libvlc_media_player_t *p_mi,
                             libvlc_exception_t *p_e )
 {
+    int width;
+
     vout_thread_t *p_vout = GetVout( p_mi, p_e );
-    if( !p_vout )
-        return 0;
+    if( !p_vout ) return 0;
+
+    width = p_vout->i_window_width;
 
     vlc_object_release( p_vout );
 
-    return p_vout->i_window_width;
+    return width;
 }
 
 int libvlc_media_player_has_vout( libvlc_media_player_t *p_mi,