]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/sgimb.c
vcdx: Fix memleaks.
[vlc] / modules / demux / playlist / sgimb.c
index f45a0e665acc3d1f3c93ab1e6de417aebf79bdc1..2f5ec2298208197f6fe89aa4fac50f57d456fa80 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_demux.h>
 #include "playlist.h"
 
@@ -135,7 +135,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args );
 /*****************************************************************************
  * Activate: initializes m3u demux structures
  *****************************************************************************/
-int E_(Import_SGIMB)( vlc_object_t * p_this )
+int Import_SGIMB( vlc_object_t * p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
     const uint8_t *p_peek;
@@ -179,7 +179,7 @@ int E_(Import_SGIMB)( vlc_object_t * p_this )
 /*****************************************************************************
  * Deactivate: frees unused data
  *****************************************************************************/
-void E_(Close_SGIMB)( vlc_object_t *p_this )
+void Close_SGIMB( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
@@ -325,25 +325,16 @@ static int Demux ( demux_t *p_demux )
     {
         /* Definetly schedules multicast session */
         /* We don't care if it's live or not */
-        char *temp;
-
-        asprintf( &temp, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
         free( p_sys->psz_uri );
-        p_sys->psz_uri = strdup( temp );
-        free( temp );
+        asprintf( &p_sys->psz_uri, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port );
     }
 
     if( p_sys->psz_uri == NULL )
     {
         if( p_sys->psz_server && p_sys->psz_location )
         {
-            char *temp;
-
-            asprintf( &temp, "rtsp://" "%s:%i%s",
+            asprintf( &p_sys->psz_uri, "rtsp://" "%s:%i%s",
                      p_sys->psz_server, p_sys->i_port > 0 ? p_sys->i_port : 554, p_sys->psz_location );
-
-            p_sys->psz_uri = strdup( temp );
-            free( temp );
         }
     }
 
@@ -351,23 +342,18 @@ static int Demux ( demux_t *p_demux )
     {
         /* It's definetly a simulcasted scheduled stream */
         /* We don't care if it's live or not */
-        char *temp;
-
         if( p_sys->psz_uri == NULL )
         {
             msg_Err( p_demux, "no URI was found" );
             return -1;
         }
 
-        asprintf( &temp, "%s%%3FMeDiAbAsEshowingId=%d%%26MeDiAbAsEconcert%%3FMeDiAbAsE",
-                p_sys->psz_uri, p_sys->i_sid );
-
         free( p_sys->psz_uri );
-        p_sys->psz_uri = strdup( temp );
-        free( temp );
+        asprintf( &p_sys->psz_uri, "%s%%3FMeDiAbAsEshowingId=%d%%26MeDiAbAsEconcert%%3FMeDiAbAsE",
+                p_sys->psz_uri, p_sys->i_sid );
     }
 
-    p_child = input_ItemNewWithType( (vlc_object_t *)p_playlist, p_sys->psz_uri,
+    p_child = input_ItemNewWithType( VLC_OBJECT(p_demux), p_sys->psz_uri,
                       p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri,
                       0, NULL, p_sys->i_duration, ITEM_TYPE_NET );