]> git.sesse.net Git - vlc/commitdiff
mmsh: factorize.
authorRémi Duraffort <ivoire@videolan.org>
Fri, 16 Oct 2009 16:22:56 +0000 (18:22 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Fri, 16 Oct 2009 16:29:49 +0000 (18:29 +0200)
modules/access/mms/mmsh.c

index ff66d398853b8e499c346bcf77fc414f2096e976..0f5086cca7b570b549fd0e3612f6d07aee881da7 100644 (file)
@@ -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 );