aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-07 22:15:20 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-07 22:15:20 +0200
commitb219d1890c624d918ba658445b991735f8b804db (patch)
tree9bc34198f5b06f416f3e83035d04544046b4c73c
parentbfa568e448133501cdb496b3caea2282c7430b85 (diff)
downloadlibssh-b219d1890c624d918ba658445b991735f8b804db.tar.gz
libssh-b219d1890c624d918ba658445b991735f8b804db.tar.xz
libssh-b219d1890c624d918ba658445b991735f8b804db.zip
tests: Don't leak memory in options test.
-rw-r--r--tests/unittests/torture_options.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c
index faa8ac2c..76da3edb 100644
--- a/tests/unittests/torture_options.c
+++ b/tests/unittests/torture_options.c
@@ -44,6 +44,7 @@ static void torture_options_get_host(void **state) {
assert_false(ssh_options_get(session, SSH_OPTIONS_HOST, &host));
assert_string_equal(host, "localhost");
+ free(host);
}
static void torture_options_set_port(void **state) {
@@ -86,6 +87,7 @@ static void torture_options_get_user(void **state) {
assert_true(rc == SSH_OK);
rc = ssh_options_get(session, SSH_OPTIONS_USER, &user);
assert_string_equal(user, "magicaltrevor");
+ free(user);
}
static void torture_options_set_fd(void **state) {
@@ -163,6 +165,7 @@ static void torture_options_get_identity(void **state) {
rc = ssh_options_get(session, SSH_OPTIONS_IDENTITY, &identity);
assert_true(rc == SSH_OK);
assert_string_equal(identity, "identity1");
+ SAFE_FREE(identity);
rc = ssh_options_set(session, SSH_OPTIONS_IDENTITY, "identity2");
assert_true(rc == 0);
@@ -170,6 +173,7 @@ static void torture_options_get_identity(void **state) {
rc = ssh_options_get(session, SSH_OPTIONS_IDENTITY, &identity);
assert_true(rc == SSH_OK);
assert_string_equal(identity, "identity2");
+ free(identity);
}
int torture_run_tests(void) {