aboutsummaryrefslogtreecommitdiff
path: root/src/known_hosts.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-09-08 13:42:30 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-09-08 13:42:30 +0200
commit09da9418cc284a799e2ff5807de08dcaf5e83461 (patch)
treeea17ea29742495aec65c0020f01764e6684bc760 /src/known_hosts.c
parent6d3d5a446e6791fd2f102b4ae8774e8df2622dc7 (diff)
downloadlibssh-09da9418cc284a799e2ff5807de08dcaf5e83461.tar.gz
libssh-09da9418cc284a799e2ff5807de08dcaf5e83461.tar.xz
libssh-09da9418cc284a799e2ff5807de08dcaf5e83461.zip
known_hosts: Fix a free before last use.
Diffstat (limited to 'src/known_hosts.c')
-rw-r--r--src/known_hosts.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/known_hosts.c b/src/known_hosts.c
index 4200730f..7c07d43d 100644
--- a/src/known_hosts.c
+++ b/src/known_hosts.c
@@ -621,8 +621,8 @@ int ssh_write_knownhost(ssh_session session) {
}
} else {
rc = ssh_pki_export_pubkey_base64(key, &b64_key);
- ssh_key_free(key);
if (rc < 0) {
+ ssh_key_free(key);
fclose(file);
SAFE_FREE(host);
return -1;
@@ -634,6 +634,7 @@ int ssh_write_knownhost(ssh_session session) {
key->type_c,
b64_key);
+ ssh_key_free(key);
SAFE_FREE(host);
SAFE_FREE(b64_key);
}