]> git.sesse.net Git - vlc/blobdiff - modules/access/dshow/dshow.cpp
DShow: small fixes on error paths
[vlc] / modules / access / dshow / dshow.cpp
index cebfc09ab25d275faeb283310880314003ad8130..b61769ef5a1d46be691ed80c037f4e07ce6951b9 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * dshow.cpp : DirectShow access module for vlc
  *****************************************************************************
- * Copyright (C) 2002, 2003 the VideoLAN team
+ * Copyright (C) 2002-2004, 2006, 2008, 2010 the VideoLAN team
  * $Id$
  *
  * Author: Gildas Bazin <gbazin@videolan.org>
@@ -2326,6 +2326,7 @@ static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_graph,
         if (FAILED(hr))
         {
             msg_Dbg( p_this, "Couldn't QI for IKsPropertySet" );
+            p_TV->Release();
             return;
         }
 
@@ -2349,7 +2350,7 @@ static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_graph,
         else
         {
             msg_Dbg( p_this, "KSPROPERTY_TUNER_MODE_CAPS not supported!" );
-            return;
+            goto free_on_error;
         }
 
         msg_Dbg( p_this, "Frequency range supproted from %d to %d.", ModeCaps.MinFrequency, ModeCaps.MaxFrequency);
@@ -2378,13 +2379,13 @@ static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_graph,
                 if(FAILED(hr))
                 {
                     msg_Dbg( p_this, "Couldn't set KSPROPERTY_TUNER_FREQUENCY!" );
-                    return;
+                    goto free_on_error;
                 }
             }
             else
             {
                 msg_Dbg( p_this, "Requested frequency exceeds the supported range!" );
-                return;
+                goto free_on_error;
             }
         }
 
@@ -2401,15 +2402,16 @@ static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_graph,
                 if(FAILED(hr))
                 {
                     msg_Dbg( p_this, "Couldn't set KSPROPERTY_TUNER_STANDARD!" );
-                    return;
+                    goto free_on_error;
                 }
             }
             else
             {
                 msg_Dbg( p_this, "Requested video standard is not supported by the tuner!" );
-                return;
+                goto free_on_error;
             }
         }
+free_on_error:
         pKs->Release();
     }