[vlc-commits] access:dshow: fix crash when opening dshow:// fails
    Steve Lhomme 
    git at videolan.org
       
    Mon Nov 27 21:46:17 CET 2017
    
    
  
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Mon Nov 27 13:50:10 2017 +0100| [d83af09052999dd521cf54a717979a0b423d344c] | committer: Jean-Baptiste Kempf
access:dshow: fix crash when opening dshow:// fails
The MTA is never acquired but it's released on CommonClose(). So we acquire it
early.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d83af09052999dd521cf54a717979a0b423d344c
---
 modules/access/dshow/dshow.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 2453a9f2e4..f22571e183 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -659,12 +659,6 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
 
     if( p_sys->pp_streams.empty() ) return VLC_EGENERIC;
 
-    if( vlc_mta_acquire( p_this ) == false )
-    {
-        msg_Err( p_this, "Failed to acquire MTA" );
-        return VLC_EGENERIC;
-    }
-
     return VLC_SUCCESS;
 }
 
@@ -683,6 +677,12 @@ static int DemuxOpen( vlc_object_t *p_this )
 
     ComContext ctx( COINIT_MULTITHREADED );
 
+    if( vlc_mta_acquire( p_this ) == false )
+    {
+        msg_Err( p_this, "Failed to acquire MTA" );
+        return VLC_EGENERIC;
+    }
+
     if( CommonOpen( p_this, p_sys, true ) != VLC_SUCCESS )
     {
         CommonClose( p_this, p_sys );
@@ -790,6 +790,12 @@ static int AccessOpen( vlc_object_t *p_this )
 
     ComContext ctx( COINIT_MULTITHREADED );
 
+    if( vlc_mta_acquire( p_this ) == false )
+    {
+        msg_Err( p_this, "Failed to acquire MTA" );
+        return VLC_EGENERIC;
+    }
+
     if( CommonOpen( p_this, p_sys, false ) != VLC_SUCCESS )
     {
         CommonClose( p_this, p_sys );
    
    
More information about the vlc-commits
mailing list