Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Nov 11, 2024
1 parent 59d3484 commit 72e0317
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crypto/evp_extra/evp_extra_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3031,15 +3031,15 @@ TEST(EVPExtraTest, KeygenCallbacks) {
}

struct ParamgenCBParam {
std::string name;
const char* name;
int pkey_type;
std::string setup_command;
std::string setup_arg;
const char* setup_command;
const char* setup_arg;
int keygen_info_0;
int keygen_into_1;
};

static const struct ParamgenCBParam paramgenCBparams[] = {
static const ParamgenCBParam paramgenCBparams[] = {
// DH_generate_parameters_ex makes a final call to `BN_GENCB_call(cb, 3, 0)`
{"DH", EVP_PKEY_DH, "dh_paramgen_prime_len", "512", 3, 0},
// dsa_internal_paramgen makes a fubak call to `BN_GENCB_call(cb, 3, 1))`
Expand All @@ -3050,7 +3050,7 @@ class PerParamgenCBTest : public testing::TestWithParam<ParamgenCBParam> {};

INSTANTIATE_TEST_SUITE_P(All, PerParamgenCBTest, testing::ValuesIn(paramgenCBparams),
[](const testing::TestParamInfo<ParamgenCBParam> &params)
-> std::string { return params.param.name; });
-> const char* { return params.param.name; });

TEST_P(PerParamgenCBTest, ParamgenCallbacks) {
bssl::UniquePtr<EVP_PKEY_CTX> ctx(EVP_PKEY_CTX_new_id(GetParam().pkey_type, nullptr));
Expand All @@ -3067,7 +3067,7 @@ TEST_P(PerParamgenCBTest, ParamgenCallbacks) {
// Generating an DH params will trigger the callback.
EVP_PKEY *pkey = EVP_PKEY_new();
ASSERT_EQ(EVP_PKEY_paramgen_init(ctx.get()), 1);
ASSERT_TRUE(EVP_PKEY_CTX_ctrl_str(ctx.get(), GetParam().setup_command.c_str(), GetParam().setup_arg.c_str()));
ASSERT_TRUE(EVP_PKEY_CTX_ctrl_str(ctx.get(), GetParam().setup_command, GetParam().setup_arg));
ASSERT_TRUE(EVP_PKEY_paramgen(ctx.get(), &pkey));
ASSERT_TRUE(pkey);

Expand Down

0 comments on commit 72e0317

Please sign in to comment.