summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2008-05-26 22:18:38 +0000
committerColin Watson <cjwatson@debian.org>2008-05-26 22:18:38 +0000
commit0fdfa323b273d756eff362f83ac7e62eb557f507 (patch)
tree0364593478de29b8d6c9f8f8f5a05ca2aa1cb847 /sshd.c
parent93e9c23240b154d074dc33f26ccb23f8874f8c3a (diff)
Fix memory leak of blacklisted host keys (thanks, Dmitry V. Levin).
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sshd.c b/sshd.c
index 80cfd56d8..ac539d6bb 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1496,10 +1496,6 @@ main(int ac, char **av)
1496 1496
1497 for (i = 0; i < options.num_host_key_files; i++) { 1497 for (i = 0; i < options.num_host_key_files; i++) {
1498 key = key_load_private(options.host_key_files[i], "", NULL); 1498 key = key_load_private(options.host_key_files[i], "", NULL);
1499 if (key && reject_blacklisted_key(key, 1) == 1) {
1500 sensitive_data.host_keys[i] = NULL;
1501 continue;
1502 }
1503 sensitive_data.host_keys[i] = key; 1499 sensitive_data.host_keys[i] = key;
1504 if (key == NULL) { 1500 if (key == NULL) {
1505 error("Could not load host key: %s", 1501 error("Could not load host key: %s",
@@ -1507,6 +1503,11 @@ main(int ac, char **av)
1507 sensitive_data.host_keys[i] = NULL; 1503 sensitive_data.host_keys[i] = NULL;
1508 continue; 1504 continue;
1509 } 1505 }
1506 if (reject_blacklisted_key(key, 1) == 1) {
1507 key_free(key);
1508 sensitive_data.host_keys[i] = NULL;
1509 continue;
1510 }
1510 switch (key->type) { 1511 switch (key->type) {
1511 case KEY_RSA1: 1512 case KEY_RSA1:
1512 sensitive_data.ssh1_host_key = key; 1513 sensitive_data.ssh1_host_key = key;