summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-06-14 16:34:49 +0000
committerYann Ylavic <ylavic@apache.org>2018-06-14 16:34:49 +0000
commitd3b008085c7acc05be20328c03590062861badce (patch)
tree493b42b956ef6cd883b76f025af13c10438b1232 /test
parent51afaeaaf63a9d4b61ab14ad8578fa293946f409 (diff)
downloadapr-d3b008085c7acc05be20328c03590062861badce.tar.gz
apr_crypto: follow up to r1833359: fix some root pool scopes (possible leaks).
Keep the root pool scope for things that need it only (global lists of drivers or libs), but otherwise use the passed in pool (crypto libs, default PRNG, errors). This allows the caller to control the scope of initialization functions, and for instance be able to re-initialize when apr_crypto is unloaded/reloaded from a DSO attached to the passed-in pool (e.g. mod_ssl in httpd). apu_dso_load() needs to return its handles when called multiple times (EINIT), it's not the caller's job (like crypto drivers) to maintain them. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1833525 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/testcrypto.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/testcrypto.c b/test/testcrypto.c
index e25095450..7c8a7c95e 100644
--- a/test/testcrypto.c
+++ b/test/testcrypto.c
@@ -559,7 +559,10 @@ static void test_crypto_init(abts_case *tc, void *data)
apr_pool_create(&pool, NULL);
- rv = apr_crypto_init(pool);
+ /* Use root pool (top level init) so that the crypto lib is
+ * not cleanup on pool destroy below (e.g. openssl can't re-init).
+ */
+ rv = apr_crypto_init(apr_pool_parent_get(pool));
ABTS_ASSERT(tc, "failed to init apr_crypto", rv == APR_SUCCESS);
apr_pool_destroy(pool);
@@ -1680,7 +1683,7 @@ abts_suite *testcrypto(abts_suite *suite)
{
suite = ADD_SUITE(suite);
- /* test simple init and shutdown */
+ /* test simple init and shutdown (keep first) */
abts_run_test(suite, test_crypto_init, NULL);
/* test key parsing - openssl */