summaryrefslogtreecommitdiffstats
path: root/test/drbgtest.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-08-09 17:26:39 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-08-10 10:52:40 +1000
commitc23add3676634ced6662929d60f266a9f5062e7b (patch)
treecd0988429e7737410e288ef4392045a13ba6ca5e /test/drbgtest.c
parent04cb5ec0b74896fe806625ac4d87e3396890f246 (diff)
Fix memory leak in drbgtest
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/12613)
Diffstat (limited to 'test/drbgtest.c')
-rw-r--r--test/drbgtest.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/test/drbgtest.c b/test/drbgtest.c
index c6c8438e98..fbe5c78c58 100644
--- a/test/drbgtest.c
+++ b/test/drbgtest.c
@@ -531,10 +531,10 @@ static EVP_RAND_CTX *new_drbg(EVP_RAND_CTX *parent)
if (!TEST_ptr(rand = EVP_RAND_fetch(NULL, "CTR-DRBG", NULL))
|| !TEST_ptr(drbg = EVP_RAND_CTX_new(rand, parent))
|| !TEST_true(EVP_RAND_set_ctx_params(drbg, params))) {
- EVP_RAND_CTX_rand(drbg);
- EVP_RAND_free(rand);
+ EVP_RAND_CTX_free(drbg);
drbg = NULL;
}
+ EVP_RAND_free(rand);
return drbg;
}
@@ -627,13 +627,6 @@ err:
int setup_tests(void)
{
- /*
- * TODO(3.0): figure out why and fix.
- * Create the primary DRBG here to avoid a memory leak if it is done in
- * the test cases.
- */
- if (RAND_get0_primary(NULL) == NULL)
- return 0;
ADD_TEST(test_rand_drbg_reseed);
ADD_TEST(test_rand_drbg_prediction_resistance);
#if defined(OPENSSL_THREADS)