mirror of
https://github.com/stefanberger/libtpms
synced 2026-01-03 07:14:35 +00:00
tpm2: Fix memory leak by freeing KDF context
Fix a memory leak by freeing the KDF context after usage. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
b4d81572c1
commit
b7c81f960a
@ -1141,7 +1141,7 @@ UINT16 OSSLCryptKDFe(TPM_ALG_ID hashAlg, // IN: hash algorithm used in HMAC
|
||||
size_t buffer_size = 0;
|
||||
UINT16 generated = 0;
|
||||
size_t offset = 0;
|
||||
EVP_KDF_CTX *ctx;
|
||||
EVP_KDF_CTX *ctx = NULL;
|
||||
EVP_KDF *kdf;
|
||||
char *buffer;
|
||||
INT16 bytes; // number of bytes to generate
|
||||
@ -1207,6 +1207,7 @@ UINT16 OSSLCryptKDFe(TPM_ALG_ID hashAlg, // IN: hash algorithm used in HMAC
|
||||
generated = bytes;
|
||||
|
||||
out:
|
||||
EVP_KDF_CTX_free(ctx);
|
||||
EVP_KDF_free(kdf);
|
||||
free(buffer);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user