vlc | branch: master | Steve Lhomme <[email protected]> | 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 <[email protected]>

> 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 );

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to