From: RĂ©mi Duraffort Date: Thu, 15 Oct 2009 13:44:07 +0000 (+0200) Subject: access_out_shoutcast: factorise. X-Git-Tag: 1.1.0-ff~2871 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3d6d7eaebce6eada889ebfbd9c22438fa7eb3825;p=vlc access_out_shoutcast: factorise. --- diff --git a/modules/access_output/shout.c b/modules/access_output/shout.c index 8bf0adaf94..8ba8ff0819 100644 --- a/modules/access_output/shout.c +++ b/modules/access_output/shout.c @@ -264,9 +264,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the shoutcast streaming format" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } /* Don't force bitrate to 0 but only use when specified. This will otherwise @@ -279,9 +277,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the information about the bitrate" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } } else @@ -304,9 +300,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the information about the samplerate" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } } @@ -318,9 +312,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the information about the number of channels" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } } @@ -332,9 +324,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the information about Ogg Vorbis quality" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } } @@ -344,9 +334,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the server status setting to public" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } } @@ -367,9 +355,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the protocol to 'icy'" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } i_ret = shout_open( p_shout ); if( i_ret == SHOUTERR_SUCCESS ) @@ -393,9 +379,7 @@ static int Open( vlc_object_t *p_this ) if( i_ret != SHOUTERR_SUCCESS ) { msg_Err( p_access, "failed to set the protocol to 'http'" ); - free( p_access->p_sys ); - free( psz_accessname ); - return VLC_EGENERIC; + goto error; } i_ret = shout_open( p_shout ); if( i_ret == SHOUTERR_SUCCESS ) @@ -439,6 +423,11 @@ static int Open( vlc_object_t *p_this ) free( psz_accessname ); return VLC_SUCCESS; + +error: + free( psz_accessname ); + free( p_sys ); + return VLC_EGENERIC; } /*****************************************************************************