From c5fa08a2a49eac726b6c42ea2e74bbbbaa31e287 Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Thu, 30 Jan 2020 18:09:54 +0100 Subject: [PATCH] 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 Reviewed-by: Jakub Jelen --- tests/client/torture_rekey.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 */