[vlc-devel] commit: Fixed a potential race condition in input_resource_HoldVout*. ( Laurent Aimar )

git version control git at videolan.org
Thu Jun 18 23:43:53 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Jun 18 22:34:59 2009 +0200| [01bec0077e7d2da2bf059297d3572e0c49e36453] | committer: Laurent Aimar 

Fixed a potential race condition in input_resource_HoldVout*.

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

 src/input/resource.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/input/resource.c b/src/input/resource.c
index 5e2b79a..5f5b0de 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -275,15 +275,12 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
 }
 static vout_thread_t *HoldVout( input_resource_t *p_resource )
 {
-    if( p_resource->i_vout <= 0 )
-        return NULL;
-
     /* TODO FIXME: p_resource->pp_vout order is NOT stable */
     vlc_mutex_lock( &p_resource->lock_hold );
 
-    vout_thread_t *p_vout = p_resource->pp_vout[0];
-
-    vlc_object_hold( p_vout );
+    vout_thread_t *p_vout = p_resource->i_vout > 0 ? p_resource->pp_vout[0] : NULL;
+    if( p_vout )
+        vlc_object_hold( p_vout );
 
     vlc_mutex_unlock( &p_resource->lock_hold );
 




More information about the vlc-devel mailing list