[vlc-devel] commit: mmsh: factorize. ( Rémi Duraffort )

git version control git at videolan.org
Fri Oct 16 18:29:39 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Oct 16 18:22:56 2009 +0200| [3484d8f084ba677bfe4dd75fd04c424ea8e653af] | committer: Rémi Duraffort 

mmsh: factorize.

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

 modules/access/mms/mmsh.c |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
index ff66d39..0f5086c 100644
--- a/modules/access/mms/mmsh.c
+++ b/modules/access/mms/mmsh.c
@@ -147,21 +147,14 @@ int MMSHOpen( access_t *p_access )
         ( *p_sys->url.psz_host == '\0' ) )
     {
         msg_Err( p_access, "invalid host" );
-        vlc_UrlClean( &p_sys->proxy );
-        vlc_UrlClean( &p_sys->url );
-        free( p_sys );
-        return VLC_EGENERIC;
+        goto error;
     }
     if( p_sys->url.i_port <= 0 )
         p_sys->url.i_port = 80;
 
     if( Describe( p_access, &psz_location ) )
-    {
-        vlc_UrlClean( &p_sys->proxy );
-        vlc_UrlClean( &p_sys->url );
-        free( p_sys );
-        return VLC_EGENERIC;
-    }
+        goto error;
+
     /* Handle redirection */
     if( psz_location && *psz_location )
     {
@@ -172,11 +165,8 @@ int MMSHOpen( access_t *p_access )
 
         if( !p_input )
         {
-            vlc_UrlClean( &p_sys->proxy );
-            vlc_UrlClean( &p_sys->url );
-            free( p_sys );
             free( psz_location );
-            return VLC_EGENERIC;
+            goto error;
         }
         /** \bug we do not autodelete here */
         p_new_loc = input_item_New( p_access, psz_location, psz_location );
@@ -197,10 +187,7 @@ int MMSHOpen( access_t *p_access )
     {
         msg_Err( p_access, "cannot start stream" );
         free( p_sys->p_header );
-        vlc_UrlClean( &p_sys->proxy );
-        vlc_UrlClean( &p_sys->url );
-        free( p_sys );
-        return VLC_EGENERIC;
+        goto error;
     }
 
     if( !p_sys->b_broadcast )
@@ -209,6 +196,12 @@ int MMSHOpen( access_t *p_access )
     }
 
     return VLC_SUCCESS;
+
+error:
+    vlc_UrlClean( &p_sys->proxy );
+    vlc_UrlClean( &p_sys->url );
+    free( p_sys );
+    return VLC_EGENERIC;
 }
 
 /*****************************************************************************
@@ -220,7 +213,7 @@ void  MMSHClose ( access_t *p_access )
 
     Stop( p_access );
 
-    free( p_sys->p_header  );
+    free( p_sys->p_header );
 
     vlc_UrlClean( &p_sys->proxy );
     vlc_UrlClean( &p_sys->url );




More information about the vlc-devel mailing list