Skip to content
Snippets Groups Projects
Commit df1ee8c9 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

sftp: fix usage of NULL config_GetUserDir result

parent 7800ddaa
No related branches found
No related tags found
1 merge request!2468fix usage of NULL config_GetUserDir/config_GetSysPath results
......@@ -324,13 +324,17 @@ static int Open( vlc_object_t* p_this )
goto error;
psz_home = config_GetUserDir( VLC_HOME_DIR );
char *psz_knownhosts_file;
if( asprintf( &psz_knownhosts_file, "%s/.ssh/known_hosts", psz_home ) != -1 )
if (likely(psz_home != NULL))
{
if( libssh2_knownhost_readfile( ssh_knownhosts, psz_knownhosts_file,
LIBSSH2_KNOWNHOST_FILE_OPENSSH ) < 0 )
msg_Err( p_access, "Failure reading known_hosts '%s'", psz_knownhosts_file );
free( psz_knownhosts_file );
char *psz_knownhosts_file;
if( asprintf( &psz_knownhosts_file, "%s/.ssh/known_hosts", psz_home ) != -1 )
{
if( libssh2_knownhost_readfile( ssh_knownhosts, psz_knownhosts_file,
LIBSSH2_KNOWNHOST_FILE_OPENSSH ) < 0 )
msg_Err( p_access, "Failure reading known_hosts '%s'", psz_knownhosts_file );
free( psz_knownhosts_file );
}
free( psz_home );
}
const char *fingerprint = libssh2_session_hostkey( p_sys->ssh_session, &i_len, &i_type );
......@@ -558,7 +562,6 @@ static int Open( vlc_object_t* p_this )
i_result = VLC_SUCCESS;
error:
free( psz_home );
free( psz_session_username );
free( psz_path );
vlc_credential_clean( &credential );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment