Commit e7254d38 authored by Rémi Duraffort's avatar Rémi Duraffort

sout_std: fix potential memleaks.

parent d8fe1e81
......@@ -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 ) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment