mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
wolfcrypt/src/port/kcapi/kcapi_hmac.c: fix memory leak in wc_HmacSetKey() (fixes #4731).
This commit is contained in:
@ -102,7 +102,7 @@ int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, word32 length)
|
||||
const char* ciphername = NULL;
|
||||
|
||||
if ((hmac == NULL || (key == NULL && length != 0))) {
|
||||
ret = BAD_FUNC_ARG;
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FIPS
|
||||
@ -183,7 +183,7 @@ int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, word32 length)
|
||||
hmac->macType = type;
|
||||
}
|
||||
|
||||
if (ret == 0 && hmac->handle == NULL) {
|
||||
if (hmac->handle != NULL) {
|
||||
kcapi_md_destroy(hmac->handle);
|
||||
hmac->handle = NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user