Free EVP ctx pkey

This commit is contained in:
Tesfa Mael
2019-12-18 17:39:53 -08:00
parent 3f13b49fa3
commit 48e59eaeb1
2 changed files with 6 additions and 2 deletions

View File

@ -16132,7 +16132,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
{ {
WOLFSSL_ENTER("EVP_MD_CTX_cleanup"); WOLFSSL_ENTER("EVP_MD_CTX_cleanup");
if (ctx->pctx != NULL) if (ctx->pctx != NULL)
wolfSSL_EVP_PKEY_CTX_free(ctx->pctx); XFREE(ctx->pctx, NULL, DYNAMIC_TYPE_PUBLIC_KEY);
if (ctx->macType == (NID_hmac & 0xFF)) { if (ctx->macType == (NID_hmac & 0xFF)) {
wc_HmacFree(&ctx->hash.hmac); wc_HmacFree(&ctx->hash.hmac);
@ -23447,7 +23447,9 @@ void wolfSSL_EVP_PKEY_free(WOLFSSL_EVP_PKEY* key)
break; break;
} }
wc_FreeMutex(&key->refMutex); if (wc_FreeMutex(&key->refMutex) != 0) {
WOLFSSL_MSG("Couldn't free pkey mutex");
}
XFREE(key, key->heap, DYNAMIC_TYPE_PUBLIC_KEY); XFREE(key, key->heap, DYNAMIC_TYPE_PUBLIC_KEY);
} }
} }

View File

@ -901,6 +901,8 @@ int wolfSSL_EVP_PKEY_CTX_free(WOLFSSL_EVP_PKEY_CTX *ctx)
{ {
if (ctx == NULL) return 0; if (ctx == NULL) return 0;
WOLFSSL_ENTER("EVP_PKEY_CTX_free"); WOLFSSL_ENTER("EVP_PKEY_CTX_free");
if (ctx->pkey != NULL)
wolfSSL_EVP_PKEY_free(ctx->pkey);
XFREE(ctx, NULL, DYNAMIC_TYPE_PUBLIC_KEY); XFREE(ctx, NULL, DYNAMIC_TYPE_PUBLIC_KEY);
return WOLFSSL_SUCCESS; return WOLFSSL_SUCCESS;
} }