if (ssh->ssh_session == NULL) {
failf(data, "Failure initialising ssh session\n");
Curl_safefree(ssh->path);
+ Curl_safefree(working_path);
return CURLE_FAILED_INIT;
}
#ifdef CURL_LIBSSH2_DEBUG
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
Curl_safefree(ssh->path);
+ Curl_safefree(working_path);
return CURLE_FAILED_INIT;
}
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
Curl_safefree(ssh->path);
+ Curl_safefree(working_path);
return CURLE_OUT_OF_MEMORY;
}
infof(data, "SSH authentication methods available: %s\n", authlist);
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
Curl_safefree(ssh->path);
+ Curl_safefree(working_path);
return CURLE_FAILED_INIT;
}
failf(data, "Failure initialising sftp session\n");
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
+ Curl_safefree(working_path);
return CURLE_FAILED_INIT;
}
ssh->sftp_session = NULL;
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
+ Curl_safefree(working_path);
return CURLE_OUT_OF_MEMORY;
}
}
if (conn->protocol == PROT_SCP) {
real_path = (char *)malloc(working_path_len+1);
if (real_path == NULL) {
- Curl_safefree(working_path);
+ libssh2_sftp_shutdown(ssh->sftp_session);
+ ssh->sftp_session = NULL;
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
+ Curl_safefree(working_path);
return CURLE_OUT_OF_MEMORY;
}
if (working_path[1] == '~')
else {
real_path = (char *)malloc(working_path_len+1);
if (real_path == NULL) {
+ libssh2_sftp_shutdown(ssh->sftp_session);
+ ssh->sftp_session = NULL;
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
Curl_safefree(working_path);
memcpy(real_path, working_path, 1+working_path_len);
}
}
- else
+ else {
+ libssh2_sftp_shutdown(ssh->sftp_session);
+ ssh->sftp_session = NULL;
+ libssh2_session_free(ssh->ssh_session);
+ ssh->ssh_session = NULL;
+ Curl_safefree(working_path);
return CURLE_FAILED_INIT;
+ }
Curl_safefree(working_path);
ssh->path = real_path;