aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-08-08 09:44:49 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-08-08 15:04:59 +0200
commit8c1136741055ad2331e64e5d347acde341938c3f (patch)
tree3db9a24bd1c05ae7df2000281861e56aafc1a916
parent460026459b049f99d25b2940b0bb19fe1c61feb1 (diff)
downloadlibssh-8c1136741055ad2331e64e5d347acde341938c3f.tar.gz
libssh-8c1136741055ad2331e64e5d347acde341938c3f.tar.xz
libssh-8c1136741055ad2331e64e5d347acde341938c3f.zip
tests: Fix memory leak in torture_knownhosts_read_file()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--tests/unittests/torture_knownhosts_parsing.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unittests/torture_knownhosts_parsing.c b/tests/unittests/torture_knownhosts_parsing.c
index 099a4594..f0afd390 100644
--- a/tests/unittests/torture_knownhosts_parsing.c
+++ b/tests/unittests/torture_knownhosts_parsing.c
@@ -229,6 +229,15 @@ static void torture_knownhosts_read_file(void **state)
type = ssh_key_type(entry->publickey);
assert_int_equal(type, SSH_KEYTYPE_ED25519);
}
+
+ it = ssh_list_get_iterator(entry_list);
+ for (;it != NULL; it = it->next) {
+ struct ssh_knownhosts_entry *entry = NULL;
+
+ entry = ssh_iterator_value(struct ssh_knownhosts_entry *, it);
+ SSH_KNOWNHOSTS_ENTRY_FREE(entry);
+ }
+ ssh_list_free(entry_list);
}
static void torture_knownhosts_host_exists(void **state)