[vlc-devel] [PATCH] access:dshow: fix crash when opening dshow:// fails

Steve Lhomme robux4 at videolabs.io
Mon Nov 27 13:50:10 CET 2017


The MTA is never acquired but it's released on CommonClose(). So we acquire it
early.
---
 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 0bc457cc2f..2b6a4ccf56 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 );
-- 
2.14.2



More information about the vlc-devel mailing list