1
1

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>
Этот коммит содержится в:
Anderson Toshiyuki Sasaki 2020-01-30 18:09:54 +01:00
родитель 89194e0d3a
Коммит c5fa08a2a4

Просмотреть файл

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