aboutsummaryrefslogtreecommitdiff
path: root/tests/client
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-01-30 18:09:54 +0100
committerAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-02-24 19:30:35 +0100
commitc5fa08a2a49eac726b6c42ea2e74bbbbaa31e287 (patch)
tree81976ee3bba2197f1d3de6b5120b79d1b0d00d6d /tests/client
parent89194e0d3ae3a05b8eca832df5c00ea5f130e237 (diff)
downloadlibssh-c5fa08a2a49eac726b6c42ea2e74bbbbaa31e287.tar.gz
libssh-c5fa08a2a49eac726b6c42ea2e74bbbbaa31e287.tar.xz
libssh-c5fa08a2a49eac726b6c42ea2e74bbbbaa31e287.zip
tests: Close SFTP file opened during rekey tests
The SFTP files wouldn't be closed during the rekey tests leading to memory leak. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'tests/client')
-rw-r--r--tests/client/torture_rekey.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/client/torture_rekey.c b/tests/client/torture_rekey.c
index a70b39d6..c599332d 100644
--- a/tests/client/torture_rekey.c
+++ b/tests/client/torture_rekey.c
@@ -269,6 +269,7 @@ static void torture_rekey_recv(void **state)
int fd;
sftp_file file;
mode_t mask;
+ int rc;
/* The blocks limit is set correctly */
c = s->ssh.session->current_crypto;
@@ -302,6 +303,8 @@ static void torture_rekey_recv(void **state)
assert_int_equal(byteswritten, bytesread);
}
+ rc = sftp_close(file);
+ assert_int_equal(rc, SSH_NO_ERROR);
close(fd);
/* The rekey limit was restored in the new crypto to the same value */
@@ -465,6 +468,7 @@ static void torture_rekey_server_recv(void **state)
int fd;
sftp_file file;
mode_t mask;
+ int rc;
/* Copy the initial secret hash = session_id so we know we changed keys later */
c = s->ssh.session->current_crypto;
@@ -492,6 +496,8 @@ static void torture_rekey_server_recv(void **state)
assert_int_equal(byteswritten, bytesread);
}
+ rc = sftp_close(file);
+ assert_int_equal(rc, SSH_NO_ERROR);
close(fd);
/* Check that the secret hash is different than initially */