[vlc-devel] commit: sout_std: fix potential memleaks. ( Rémi Duraffort )
git version control
git at videolan.org
Sat Oct 10 11:57:44 CEST 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Oct 2 20:23:05 2009 +0200| [e7254d3881548a24734e0493e2058e753f6e33cd] | committer: Rémi Duraffort
sout_std: fix potential memleaks.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e7254d3881548a24734e0493e2058e753f6e33cd
---
modules/stream_out/standard.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index 8ced7ae..b1b91dc 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -213,16 +213,20 @@ static int Open( vlc_object_t *p_this )
psz_bind = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "bind" );
psz_path = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "path" );
- if( psz_bind ) psz_url = psz_bind;
- if( psz_url && psz_path )
+ if( psz_bind && psz_path )
{
- if( asprintf( &psz_url,"%s/%s",psz_url,psz_path ) == -1 )
+ if( asprintf( &psz_url, "%s/%s", psz_bind, psz_path ) == -1 )
psz_url = NULL;
- free( psz_path );
}
+ else if( psz_bind )
+ {
+ psz_url = psz_bind;
+ psz_bind = NULL;
+ }
+ free( psz_path );
var_Get( p_stream, SOUT_CFG_PREFIX "dst", &val );
- if( *val.psz_string )
+ if( *val.psz_string )
{
free( psz_url);
psz_url = val.psz_string;
@@ -233,6 +237,9 @@ static int Open( vlc_object_t *p_this )
p_sys = p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) );
if( !p_sys )
{
+ free( psz_access );
+ free( psz_mux );
+ free( psz_bind );
free( psz_url );
return VLC_ENOMEM;
}
@@ -296,6 +303,7 @@ static int Open( vlc_object_t *p_this )
else
{
msg_Err( p_stream, "no access _and_ no muxer (fatal error)" );
+ free( psz_bind );
free( psz_url );
free( p_sys );
return VLC_EGENERIC;
@@ -320,6 +328,9 @@ static int Open( vlc_object_t *p_this )
else
{
msg_Err( p_stream, "no mux specified or found by extension" );
+ free( psz_access );
+ free( psz_bind );
+ free( psz_url );
free( p_sys );
return VLC_EGENERIC;
}
@@ -389,6 +400,7 @@ static int Open( vlc_object_t *p_this )
psz_access, psz_mux, psz_url );
free( psz_access );
free( psz_mux );
+ free( psz_bind );
free( psz_url );
free( p_sys );
return VLC_EGENERIC;
@@ -405,6 +417,7 @@ static int Open( vlc_object_t *p_this )
sout_AccessOutDelete( p_access );
free( psz_access );
free( psz_mux );
+ free( psz_bind );
free( psz_url );
free( p_sys );
return VLC_EGENERIC;
@@ -477,6 +490,7 @@ static int Open( vlc_object_t *p_this )
free( psz_access );
free( psz_mux );
+ free( psz_bind );
free( psz_url );
if( !sout_AccessOutCanControlPace( p_access ) )
More information about the vlc-devel
mailing list