Commit 99fec92f authored by Rafaël Carré's avatar Rafaël Carré

Do not duplicate potentially NULL strings

parent 32edee83
......@@ -740,7 +740,8 @@ static char *config_GetFooDir (const char *xdg_name, const char *xdg_default)
/* XDG Base Directory Specification - Version 0.6 */
snprintf (var, sizeof (var), "XDG_%s_HOME", xdg_name);
psz_env = FromLocaleDup (getenv (var));
char *psz_home = getenv( var );
psz_env = psz_home ? FromLocaleDup( psz_home ) : NULL;
if( psz_env )
{
if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 )
......@@ -748,7 +749,8 @@ static char *config_GetFooDir (const char *xdg_name, const char *xdg_default)
goto out;
}
psz_env = FromLocaleDup (getenv ("HOME"));
psz_home = getenv( "HOME" );
psz_env = psz_home ? FromLocaleDup( psz_home ) : NULL;
/* not part of XDG spec but we want a sensible fallback */
if( !psz_env )
psz_env = config_GetHomeDir();
......
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