The OpenSSL 3.x version of crypto_ec_key_parse_priv using
OSSL_DECODER_CTX missed the call to free the context. Fix it to avoid a
memory leak.
Fixes: 4f4479ef9e1c ("OpenSSL: crypto_ec_key_parse_{priv,pub}() without EC_KEY API")
Signed-off-by: Jouni Malinen <j@w1.fi>
NULL, NULL);
if (!ctx ||
OSSL_DECODER_from_data(ctx, &der, &der_len) != 1) {
- wpa_printf(MSG_INFO, "OpenSSL: Decoding EC private key (DER) failed: %s",
+ wpa_printf(MSG_INFO,
+ "OpenSSL: Decoding EC private key (DER) failed: %s",
ERR_error_string(ERR_get_error(), NULL));
+ if (ctx)
+ OSSL_DECODER_CTX_free(ctx);
goto fail;
}
+ OSSL_DECODER_CTX_free(ctx);
return (struct crypto_ec_key *) pkey;
fail:
crypto_ec_key_deinit((struct crypto_ec_key *) pkey);