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>
This commit is contained in:
Anderson Toshiyuki Sasaki
2020-01-30 18:09:54 +01:00
parent 89194e0d3a
commit c5fa08a2a4

View File

@@ -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 */