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

ftp: fix leak

parent 1d410d6d
...@@ -310,7 +310,6 @@ static void clearCmdTLS( access_sys_t *p_sys ) ...@@ -310,7 +310,6 @@ static void clearCmdTLS( access_sys_t *p_sys )
static int Login( vlc_object_t *p_access, access_sys_t *p_sys ) static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
{ {
int i_answer; int i_answer;
char *psz;
/* *** Open a TCP connection with server *** */ /* *** Open a TCP connection with server *** */
int fd = p_sys->cmd.fd = net_ConnectTCP( p_access, p_sys->url.psz_host, int fd = p_sys->cmd.fd = net_ConnectTCP( p_access, p_sys->url.psz_host,
...@@ -341,13 +340,6 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys ) ...@@ -341,13 +340,6 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
msg_Dbg( p_access, "connection accepted (%d)", i_answer ); msg_Dbg( p_access, "connection accepted (%d)", i_answer );
if( p_sys->url.psz_username && *p_sys->url.psz_username )
psz = strdup( p_sys->url.psz_username );
else
psz = var_InheritString( p_access, "ftp-user" );
if( !psz )
return -1;
/* Features check first */ /* Features check first */
if( ftp_SendCommand( p_access, p_sys, "FEAT" ) < 0 if( ftp_SendCommand( p_access, p_sys, "FEAT" ) < 0
|| ftp_RecvAnswer( p_access, p_sys, NULL, NULL, || ftp_RecvAnswer( p_access, p_sys, NULL, NULL,
...@@ -388,7 +380,6 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys ) ...@@ -388,7 +380,6 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
i_answer != 200 ) i_answer != 200 )
{ {
msg_Err( p_access, "Can't truncate Protection buffer size for TLS" ); msg_Err( p_access, "Can't truncate Protection buffer size for TLS" );
free( psz );
goto error; goto error;
} }
...@@ -397,12 +388,20 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys ) ...@@ -397,12 +388,20 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
i_answer != 200 ) i_answer != 200 )
{ {
msg_Err( p_access, "Can't set Data channel protection" ); msg_Err( p_access, "Can't set Data channel protection" );
free( psz );
goto error; goto error;
} }
} }
/* Send credentials over channel */ /* Send credentials over channel */
char *psz;
if( p_sys->url.psz_username && *p_sys->url.psz_username )
psz = strdup( p_sys->url.psz_username );
else
psz = var_InheritString( p_access, "ftp-user" );
if( !psz )
goto error;
if( ftp_SendCommand( p_access, p_sys, "USER %s", psz ) < 0 || if( ftp_SendCommand( p_access, p_sys, "USER %s", psz ) < 0 ||
ftp_RecvCommand( p_access, p_sys, &i_answer, NULL ) < 0 ) ftp_RecvCommand( p_access, p_sys, &i_answer, NULL ) < 0 )
{ {
......
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