[vlc-devel] commit: Do not leak psz_demux ( Rafaël Carré )
git version control
git at videolan.org
Fri May 9 23:11:56 CEST 2008
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri May 9 23:11:52 2008 +0200| [43f58febd846de699ea5dfee21f4b1f03b2adc0d]
Do not leak psz_demux
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43f58febd846de699ea5dfee21f4b1f03b2adc0d
---
modules/access/directory.c | 1 +
modules/access/dshow/dshow.cpp | 4 +++-
modules/access/dv.c | 9 +++++++--
modules/access/http.c | 19 +++++++++++++++++--
modules/access/udp.c | 3 +++
modules/access/vcd/vcd.c | 1 +
modules/access/vcdx/access.c | 1 +
7 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/modules/access/directory.c b/modules/access/directory.c
index c2a98ec..d770321 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -166,6 +166,7 @@ static int Open( vlc_object_t *p_this )
p_access->pf_control= Control;
/* Force a demux */
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "directory" );
return VLC_SUCCESS;
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 8ce9064..ee28b86 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -657,11 +657,13 @@ static int AccessOpen( vlc_object_t *p_this )
p_stream->i_fourcc == VLC_FOURCC('d','v','s','d') ||
p_stream->i_fourcc == VLC_FOURCC('d','v','h','d') )
{
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "rawdv" );
}
else if( p_stream->i_fourcc == VLC_FOURCC('m','p','2','v') )
{
- p_access->psz_demux = "mpgv";
+ free( p_access->psz_demux );
+ p_access->psz_demux = strdup( "mpgv" );
}
}
diff --git a/modules/access/dv.c b/modules/access/dv.c
index 90c6a9f..d0d962e 100644
--- a/modules/access/dv.c
+++ b/modules/access/dv.c
@@ -340,8 +340,13 @@ static block_t *Block( access_t *p_access )
access_sys_t *p_sys = p_access->p_sys;
block_t *p_block = NULL;
-// if( !p_access->psz_demux )
-// p_access->psz_demux = strdup( "rawdv" );
+#if 0
+ if( !p_access->psz_demux )
+ {
+ free( p_access->psz_demux );
+ p_access->psz_demux = strdup( "rawdv" );
+ }
+#endif
vlc_mutex_lock( &p_sys->lock );
p_block = p_sys->p_frame;
diff --git a/modules/access/http.c b/modules/access/http.c
index d8715c5..d90f01f 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -454,12 +454,21 @@ connect:
{
if( !strcasecmp( p_sys->psz_mime, "video/nsv" ) ||
!strcasecmp( p_sys->psz_mime, "video/nsa" ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "nsv" );
+ }
else if( !strcasecmp( p_sys->psz_mime, "audio/aac" ) ||
!strcasecmp( p_sys->psz_mime, "audio/aacp" ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "m4a" );
+ }
else if( !strcasecmp( p_sys->psz_mime, "audio/mpeg" ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "mp3" );
+ }
msg_Info( p_access, "Raw-audio server found, %s demuxer selected",
p_access->psz_demux );
@@ -472,8 +481,9 @@ connect:
}
else if( !p_sys->psz_mime )
{
- /* Shoutcast */
- p_access->psz_demux = strdup( "mp3" );
+ free( p_access->psz_demux );
+ /* Shoutcast */
+ p_access->psz_demux = strdup( "mp3" );
}
/* else probably Ogg Vorbis */
}
@@ -481,17 +491,22 @@ connect:
p_sys->psz_mime &&
!strcasecmp( p_sys->psz_mime, "misc/ultravox" ) )
{
+ free( p_access->psz_demux );
/* Grrrr! detect ultravox server and force NSV demuxer */
p_access->psz_demux = strdup( "nsv" );
}
else if( !strcmp( p_access->psz_access, "itpc" ) )
{
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "podcast" );
}
else if( p_sys->psz_mime &&
!strncasecmp( p_sys->psz_mime, "application/xspf+xml", 20 ) &&
( memchr( " ;\t", p_sys->psz_mime[20], 4 ) != NULL ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "xspf-open" );
+ }
if( p_sys->b_reconnect ) msg_Dbg( p_access, "auto re-connect enabled" );
diff --git a/modules/access/udp.c b/modules/access/udp.c
index b2c877f..24a4731 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -743,16 +743,19 @@ static block_t *BlockChoose( access_t *p_access )
{
case 33:
msg_Dbg( p_access, "detected MPEG2 TS over RTP" );
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "ts" );
break;
case 14:
msg_Dbg( p_access, "detected MPEG Audio over RTP" );
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "mpga" );
break;
case 32:
msg_Dbg( p_access, "detected MPEG Video over RTP" );
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "mpgv" );
break;
diff --git a/modules/access/vcd/vcd.c b/modules/access/vcd/vcd.c
index f42320b..854fbad 100644
--- a/modules/access/vcd/vcd.c
+++ b/modules/access/vcd/vcd.c
@@ -211,6 +211,7 @@ static int Open( vlc_object_t *p_this )
p_access->info.i_pos = ( p_sys->i_sector - p_sys->p_sectors[1+i_title] ) *
VCD_DATA_SIZE;
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "ps" );
return VLC_SUCCESS;
diff --git a/modules/access/vcdx/access.c b/modules/access/vcdx/access.c
index c54d6d1..0509cd7 100644
--- a/modules/access/vcdx/access.c
+++ b/modules/access/vcdx/access.c
@@ -957,6 +957,7 @@ VCDOpen ( vlc_object_t *p_this )
vcdplayer_play( p_access, itemid );
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "ps" );
#if FIXED
More information about the vlc-devel
mailing list