Commit d79eca2e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Simplification / memory error handling

parent 54bcbe13
...@@ -888,7 +888,8 @@ static int ReplayGainCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -888,7 +888,8 @@ static int ReplayGainCallback( vlc_object_t *p_this, char const *psz_cmd,
static void ReplayGainSelect( aout_instance_t *p_aout, aout_input_t *p_input ) static void ReplayGainSelect( aout_instance_t *p_aout, aout_input_t *p_input )
{ {
char *psz_replay_gain = var_GetString( p_aout, "audio-replay-gain-mode" ); char *psz_replay_gain = var_GetNonEmptyString( p_aout,
"audio-replay-gain-mode" );
int i_mode; int i_mode;
int i_use; int i_use;
float f_gain; float f_gain;
......
...@@ -482,7 +482,7 @@ void aout_EnableFilter( vlc_object_t *p_this, const char *psz_name, ...@@ -482,7 +482,7 @@ void aout_EnableFilter( vlc_object_t *p_this, const char *psz_name,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_aout ) if( p_aout )
psz_string = var_GetString( p_aout, "audio-filter" ); psz_string = var_GetNonEmptyString( p_aout, "audio-filter" );
else else
psz_string = config_GetPsz( p_this, "audio-filter" ); psz_string = config_GetPsz( p_this, "audio-filter" );
......
...@@ -790,8 +790,8 @@ static int Init( input_thread_t * p_input ) ...@@ -790,8 +790,8 @@ static int Init( input_thread_t * p_input )
} }
/* Find a usable sout and attach it to p_input */ /* Find a usable sout and attach it to p_input */
psz = var_GetString( p_input, "sout" ); psz = var_GetNonEmptyString( p_input, "sout" );
if( *psz && strncasecmp( p_input->p->input.p_item->psz_uri, "vlc:", 4 ) ) if( psz && strncasecmp( p_input->p->input.p_item->psz_uri, "vlc:", 4 ) )
{ {
/* Check the validity of the provided sout */ /* Check the validity of the provided sout */
if( p_input->p->p_sout ) if( p_input->p->p_sout )
...@@ -985,8 +985,8 @@ static int Init( input_thread_t * p_input ) ...@@ -985,8 +985,8 @@ static int Init( input_thread_t * p_input )
} }
/* Look for and add subtitle files */ /* Look for and add subtitle files */
psz_subtitle = var_GetString( p_input, "sub-file" ); psz_subtitle = var_GetNonEmptyString( p_input, "sub-file" );
if( *psz_subtitle ) if( psz_subtitle != NULL )
{ {
msg_Dbg( p_input, "forced subtitle: %s", psz_subtitle ); msg_Dbg( p_input, "forced subtitle: %s", psz_subtitle );
input_AddSubtitles( p_input, psz_subtitle, VLC_FALSE ); input_AddSubtitles( p_input, psz_subtitle, VLC_FALSE );
...@@ -1003,7 +1003,7 @@ static int Init( input_thread_t * p_input ) ...@@ -1003,7 +1003,7 @@ static int Init( input_thread_t * p_input )
/* Try to autoselect the first autodetected subtitles file /* Try to autoselect the first autodetected subtitles file
* if no subtitles file was specified */ * if no subtitles file was specified */
if( *psz_subtitle == 0 && subs && subs[0] ) if( ( psz_subtitle == NULL ) && subs && subs[0] )
{ {
input_AddSubtitles( p_input, subs[0], VLC_FALSE ); input_AddSubtitles( p_input, subs[0], VLC_FALSE );
free( subs[0] ); free( subs[0] );
...@@ -1030,8 +1030,8 @@ static int Init( input_thread_t * p_input ) ...@@ -1030,8 +1030,8 @@ static int Init( input_thread_t * p_input )
free( psz_subtitle ); free( psz_subtitle );
/* Look for slave */ /* Look for slave */
psz = var_GetString( p_input, "input-slave" ); psz = var_GetNonEmptyString( p_input, "input-slave" );
if( *psz ) if( psz != NULL )
{ {
char *psz_delim; char *psz_delim;
input_source_t *slave; input_source_t *slave;
...@@ -1059,8 +1059,8 @@ static int Init( input_thread_t * p_input ) ...@@ -1059,8 +1059,8 @@ static int Init( input_thread_t * p_input )
else free( slave ); else free( slave );
psz = psz_delim; psz = psz_delim;
} }
free( psz );
} }
if( psz ) free( psz );
} }
else else
{ {
...@@ -2224,7 +2224,7 @@ static int InputSourceInit( input_thread_t *p_input, ...@@ -2224,7 +2224,7 @@ static int InputSourceInit( input_thread_t *p_input,
} }
/* */ /* */
psz_tmp = psz = var_GetString( p_input, "access-filter" ); psz_tmp = psz = var_GetNonEmptyString( p_input, "access-filter" );
while( psz && *psz ) while( psz && *psz )
{ {
access_t *p_access = in->p_access; access_t *p_access = in->p_access;
...@@ -2243,7 +2243,7 @@ static int InputSourceInit( input_thread_t *p_input, ...@@ -2243,7 +2243,7 @@ static int InputSourceInit( input_thread_t *p_input,
psz = end; psz = end;
} }
if( psz_tmp ) free( psz_tmp ); free( psz_tmp );
/* Get infos from access */ /* Get infos from access */
if( !p_input->b_preparsing ) if( !p_input->b_preparsing )
......
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