mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-21 19:31:17 +03:00
libcrypto: fix resource leak in hmac_final
Fix a resource leak in `hmac_final`: say `HMAC_CTX_free` instead
of `HMAC_CTX_reset`. This matches the error handling as done in
`hmac_init`. Introduced with cf1e808e2f.
The problem is reproducible running the `pkd_hello` test with:
valgrind --leak-check=full ./pkd_hello -i1 -t torture_pkd_openssh_dsa_rsa_default
Resolves https://red.libssh.org/issues/252.
Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
25384e9558
commit
a64ddff3fe
@@ -422,7 +422,8 @@ void hmac_final(HMACCTX ctx, unsigned char *hashmacbuf, unsigned int *len) {
|
|||||||
HMAC_Final(ctx,hashmacbuf,len);
|
HMAC_Final(ctx,hashmacbuf,len);
|
||||||
|
|
||||||
#ifndef OLD_CRYPTO
|
#ifndef OLD_CRYPTO
|
||||||
HMAC_CTX_reset(ctx);
|
HMAC_CTX_free(ctx);
|
||||||
|
ctx = NULL;
|
||||||
#else
|
#else
|
||||||
HMAC_cleanup(ctx);
|
HMAC_cleanup(ctx);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user