fix cleanup

This commit is contained in:
Ryo Nakamura
2023-03-12 17:06:02 +09:00
parent 1028ecb53b
commit 2416b5f182
2 changed files with 8 additions and 4 deletions

View File

@@ -44,10 +44,9 @@ class mscp:
self.stop()
if self.state == _STATE_STOPPED:
self.join()
if self.state == _STATE_JOINED:
self.cleanup()
if self.state == _STATE_CLEANED:
self.free()
self.cleanup()
self.free()
def _state2str(self):
return _state_str[self.state]

View File

@@ -571,6 +571,11 @@ static void free_chunk(struct list_head *list)
void mscp_cleanup(struct mscp *m)
{
if (m->first) {
ssh_sftp_close(m->first);
m->first = NULL;
}
release_list(&m->src_list, free_src);
INIT_LIST_HEAD(&m->src_list);