diff --git a/src/vfs/sftpfs/connection.c b/src/vfs/sftpfs/connection.c index f147d5503..b5abd4a32 100644 --- a/src/vfs/sftpfs/connection.c +++ b/src/vfs/sftpfs/connection.c @@ -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); diff --git a/src/vfs/sftpfs/vfs_subclass.c b/src/vfs/sftpfs/vfs_subclass.c index b7bb39c56..4717a6b4a 100644 --- a/src/vfs/sftpfs/vfs_subclass.c +++ b/src/vfs/sftpfs/vfs_subclass.c @@ -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); } /* --------------------------------------------------------------------------------------------- */