Commit 98195bf4 authored by Rémi Duraffort's avatar Rémi Duraffort

sftp: fix potential memory leak.

parent 45b7ce9e
...@@ -153,7 +153,9 @@ static int Open( vlc_object_t* p_this ) ...@@ -153,7 +153,9 @@ static int Open( vlc_object_t* p_this )
p_sys->i_socket = net_Connect( p_access, url.psz_host, i_port, SOCK_STREAM, 0 ); p_sys->i_socket = net_Connect( p_access, url.psz_host, i_port, SOCK_STREAM, 0 );
/* Create the ssh connexion and wait until the server answer */ /* Create the ssh connexion and wait until the server answer */
p_sys->ssh_session = libssh2_session_init(); if( ( p_sys->ssh_session = libssh2_session_init() ) == NULL )
goto error;
while( ( i_ret = libssh2_session_startup( p_sys->ssh_session, while( ( i_ret = libssh2_session_startup( p_sys->ssh_session,
p_sys->i_socket ) ) p_sys->i_socket ) )
== LIBSSH2_ERROR_EAGAIN ); == LIBSSH2_ERROR_EAGAIN );
...@@ -250,6 +252,8 @@ static int Open( vlc_object_t* p_this ) ...@@ -250,6 +252,8 @@ static int Open( vlc_object_t* p_this )
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
if( p_sys->ssh_session )
libssh2_session_free( p_sys->ssh_session );
free( psz_password ); free( psz_password );
free( psz_username ); free( psz_username );
vlc_UrlClean( &url ); vlc_UrlClean( &url );
......
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