dh-gex: fix moduli file stream leak

Ensure to close the moduli file stream in `ssh_retrieve_dhgroup`.
The leak is observable with the pkd tests and valgrind with:

    valgrind \
      --track-fds=yes \
      ./pkd_hello -i1 \
      -t torture_pkd_openssh_rsa_rsa_diffie_hellman_group_exchange_sha256

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jon Simons
2019-01-29 19:43:07 -05:00
committed by Andreas Schneider
parent 04c97c0eaf
commit 886681a421

View File

@@ -481,6 +481,7 @@ static int ssh_retrieve_dhgroup(uint32_t pmin,
size,
&generator,
&modulus);
fclose(moduli);
if (rc == SSH_ERROR || *size == 0) {
goto error;
}