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

Fix NULL dereference (unlikely) (CID 112)

parent cee010ba
...@@ -210,7 +210,9 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -210,7 +210,9 @@ static int OpenDecoder( vlc_object_t *p_this )
var_Create( p_dec, "subsdec-encoding", var_Create( p_dec, "subsdec-encoding",
VLC_VAR_STRING | VLC_VAR_DOINHERIT ); VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_dec, "subsdec-encoding", &val ); var_Get( p_dec, "subsdec-encoding", &val );
if( !strcmp( val.psz_string, DEFAULT_NAME ) ) if( !val.psz_string || !*val.psz_string )
(void)0;
else if( !strcmp( val.psz_string, DEFAULT_NAME ) )
{ {
const char *psz_charset = GetFallbackEncoding(); const char *psz_charset = GetFallbackEncoding();
...@@ -218,22 +220,24 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -218,22 +220,24 @@ static int OpenDecoder( vlc_object_t *p_this )
"subsdec-autodetect-utf8" ); "subsdec-autodetect-utf8" );
p_sys->iconv_handle = vlc_iconv_open( "UTF-8", psz_charset ); p_sys->iconv_handle = vlc_iconv_open( "UTF-8", psz_charset );
msg_Dbg( p_dec, "using fallback character encoding: %s", psz_charset ); msg_Dbg( p_dec, "using fallback character encoding: %s",
psz_charset );
} }
else if( !strcmp( val.psz_string, "UTF-8" ) ) else if( !strcmp( val.psz_string, "UTF-8" ) )
{ {
msg_Dbg( p_dec, "using enforced character encoding: UTF-8" ); msg_Dbg( p_dec, "using enforced character encoding: UTF-8" );
} }
else if( val.psz_string ) else
{ {
msg_Dbg( p_dec, "using enforced character encoding: %s", val.psz_string ); msg_Dbg( p_dec, "using enforced character encoding: %s",
val.psz_string );
p_sys->iconv_handle = vlc_iconv_open( "UTF-8", val.psz_string ); p_sys->iconv_handle = vlc_iconv_open( "UTF-8", val.psz_string );
if( p_sys->iconv_handle == (vlc_iconv_t)-1 ) if( p_sys->iconv_handle == (vlc_iconv_t)-1 )
{ {
msg_Warn( p_dec, "unable to do requested conversion" ); msg_Warn( p_dec, "unable to do requested conversion" );
} }
} }
if( val.psz_string ) free( val.psz_string ); free( val.psz_string );
} }
var_Create( p_dec, "subsdec-align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_dec, "subsdec-align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
......
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