aboutsummaryrefslogtreecommitdiff
path: root/src/dh-gex.c
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2019-01-29 19:43:07 -0500
committerAndreas Schneider <asn@cryptomilk.org>2019-01-30 13:22:59 +0100
commit886681a42131632098a46174d302776339207644 (patch)
tree9bcf1b1b4cbf5a702cdd03b88b36b6ef2b631310 /src/dh-gex.c
parent04c97c0eafb8885a77bf6c075ee9739ffa329770 (diff)
downloadlibssh-886681a42131632098a46174d302776339207644.tar.gz
libssh-886681a42131632098a46174d302776339207644.tar.xz
libssh-886681a42131632098a46174d302776339207644.zip
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>
Diffstat (limited to 'src/dh-gex.c')
-rw-r--r--src/dh-gex.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/dh-gex.c b/src/dh-gex.c
index f08b3ba3..a52be036 100644
--- a/src/dh-gex.c
+++ b/src/dh-gex.c
@@ -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;
}