[vlc-devel] commit: Don't use strdup on a string created by asprintf (useless). ( Rémi Duraffort )
git version control
git at videolan.org
Thu Jul 10 23:49:29 CEST 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Jul 10 00:27:00 2008 +0200| [ce4c05bb991cd177949f2e58b01d9027a78e1dec]
Don't use strdup on a string created by asprintf (useless).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ce4c05bb991cd177949f2e58b01d9027a78e1dec
---
modules/demux/playlist/sgimb.c | 22 ++++------------------
1 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/modules/demux/playlist/sgimb.c b/modules/demux/playlist/sgimb.c
index 1701073..2f5ec22 100644
--- a/modules/demux/playlist/sgimb.c
+++ b/modules/demux/playlist/sgimb.c
@@ -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,20 +342,15 @@ 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(p_demux), p_sys->psz_uri,
More information about the vlc-devel
mailing list