aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-04-06 06:32:05 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-04-06 06:32:05 +0000
commite9ffa9a3b8bb4d44145b98d063dc2f45d409dccb (patch)
tree21318d4cce38b9dadb86f46e4de43a890ebec8b9
parent248a5381d4595774f4dbb3df76392f6001905a8c (diff)
Fixed a few memory leaks in OOM conditions.
Made libssh2 logging more verbose when debugging is enabled.
-rw-r--r--lib/ssh.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index bdf68397d..f5349092f 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -305,12 +305,12 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
libssh2_realloc, ssh);
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_trace(ssh->ssh_session, LIBSSH2_TRACE_CONN|LIBSSH2_TRACE_TRANS|LIBSSH2_TRACE_SCP|LIBSSH2_TRACE_SFTP|LIBSSH2_TRACE_ERROR);
+ libssh2_trace(ssh->ssh_session, LIBSSH2_TRACE_CONN|LIBSSH2_TRACE_TRANS|LIBSSH2_TRACE_KEX|LIBSSH2_TRACE_AUTH|LIBSSH2_TRACE_SCP|LIBSSH2_TRACE_SFTP|LIBSSH2_TRACE_ERROR|LIBSSH2_TRACE_PUBLICKEY);
infof(data, "SSH socket: %d\n", sock);
#endif /* CURL_LIBSSH2_DEBUG */
@@ -318,7 +318,6 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
failf(data, "Failure establishing ssh session\n");
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
- Curl_safefree(ssh->path);
Curl_safefree(working_path);
return CURLE_FAILED_INIT;
}
@@ -357,7 +356,6 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
if (!authlist) {
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
- Curl_safefree(ssh->path);
Curl_safefree(working_path);
return CURLE_OUT_OF_MEMORY;
}
@@ -437,7 +435,6 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
failf(data, "Authentication failure\n");
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
- Curl_safefree(ssh->path);
Curl_safefree(working_path);
return CURLE_FAILED_INIT;
}
@@ -511,6 +508,8 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
ssh->sftp_session = NULL;
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
+ Curl_safefree(ssh->homedir);
+ ssh->homedir = NULL;
Curl_safefree(working_path);
return CURLE_OUT_OF_MEMORY;
}
@@ -530,6 +529,8 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
ssh->sftp_session = NULL;
libssh2_session_free(ssh->ssh_session);
ssh->ssh_session = NULL;
+ Curl_safefree(ssh->homedir);
+ ssh->homedir = NULL;
Curl_safefree(working_path);
return CURLE_OUT_OF_MEMORY;
}