SFTP: minor refactoring.

sftpfs_super_data created at sftpfs_cb_open_connection() was freed at sftpfs_close_connection().
It should be sftpfs_cb_close_connection() for logical right location.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andreas Mohr 2016-01-03 17:33:56 +00:00 committed by Andrew Borodin
parent 298273b8f5
commit ece1d020fa
2 changed files with 8 additions and 4 deletions

View File

@ -440,9 +440,6 @@ sftpfs_close_connection (struct vfs_s_super *super, const char *shutdown_message
if (super_data == NULL)
return;
vfs_path_element_free (super_data->original_connection_info);
super_data->original_connection_info = NULL;
if (super_data->agent != NULL)
{
libssh2_agent_disconnect (super_data->agent);

View File

@ -138,11 +138,18 @@ static void
sftpfs_cb_close_connection (struct vfs_class *me, struct vfs_s_super *super)
{
GError *mcerror = NULL;
sftpfs_super_data_t *sftpfs_super_data;
(void) me;
sftpfs_close_connection (super, "Normal Shutdown", &mcerror);
sftpfs_super_data = (sftpfs_super_data_t *) super->data;
if (sftpfs_super_data != NULL)
vfs_path_element_free (sftpfs_super_data->original_connection_info);
mc_error_message (&mcerror, NULL);
g_free (super->data);
g_free (sftpfs_super_data);
}
/* --------------------------------------------------------------------------------------------- */