Skip to content

Commit 2d0e547

Browse files
committed
init: refactor pconf pool memory allocation handling, part 2
avoid increasing memory (pool) consumption over graceful restarts Signed-off-by: Hans Zandbelt <[email protected]>
1 parent fa667af commit 2d0e547

File tree

8 files changed

+102
-65
lines changed

8 files changed

+102
-65
lines changed

ChangeLog

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
11/22/2025
2-
- init: refactor pconf pool memory allocation handling, part 1
3-
should result in less memory allocation over graceful restarts
1+
11/23/2025
2+
- init: refactor pconf pool memory allocation handling
3+
avoid increasing memory (pool) consumption over graceful restarts
44

55
11/19/2025
66
- request: set the OIDC_ERROR variables when PAR is configured but not enabled by the Provider

src/cache/common.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,32 @@ static apr_byte_t oidc_cache_mutex_global_create(apr_pool_t *pool, server_rec *s
108108
#endif
109109
;
110110

111+
// TODO: need to allocate this on the server process pool to avoid crashes on
112+
// oidc_cache_mutex_unlock at shutdown time on graceful restarts,
113+
// and test/helper.c shutdown; is it because libapr cleaned it up before us?
114+
115+
// it is probably related to the remaining valgrind report on possibly lost memory:
116+
117+
/*
118+
* ==73== 24 bytes in 1 blocks are possibly lost in loss record 39 of 176
119+
* ==73== at 0x4844818: malloc (vg_replace_malloc.c:446)
120+
* ==73== by 0x4A91765: __tsearch (tsearch.c:337)
121+
* ==73== by 0x4A91765: tsearch (tsearch.c:290)
122+
* ==73== by 0x4A1C4E5: __sem_check_add_mapping (sem_routines.c:121)
123+
* ==73== by 0x4A1C1A0: sem_open@@GLIBC_2.34 (sem_open.c:195)
124+
* ==73== by 0x49622BF: ??? (in /usr/lib/x86_64-linux-gnu/libapr-1.so.0.7.5)
125+
* ==73== by 0x49633D9: apr_proc_mutex_create (in /usr/lib/x86_64-linux-gnu/libapr-1.so.0.7.5)
126+
* ==73== by 0x4961E8C: apr_global_mutex_create (in /usr/lib/x86_64-linux-gnu/libapr-1.so.0.7.5)
127+
* ==73== by 0x5A27AD3: oidc_cache_mutex_global_create (common.c:116)
128+
* ==73== by 0x5A27AD3: oidc_cache_mutex_post_config (common.c:144)
129+
* ==73== by 0x5A2750D: oidc_cache_shm_post_config (shm.c:111)
130+
* ==73== by 0x5A1D66E: oidc_cfg_post_config (cfg.c:1009)
131+
* ==73== by 0x5A15F9C: oidc_post_config (mod_auth_openidc.c:1762)
132+
* ==73== by 0x16B2C3: ap_run_post_config (in /usr/sbin/apache2)
133+
*/
134+
111135
/* create the mutex lock */
112-
rv = apr_global_mutex_create(&m->gmutex, (const char *)m->mutex_filename, mech, pool);
136+
rv = apr_global_mutex_create(&m->gmutex, (const char *)m->mutex_filename, mech, s->process->pool);
113137

114138
if (rv != APR_SUCCESS) {
115139
oidc_serror(s, "apr_global_mutex_create failed to create mutex (%d) on file %s: %s (%d)", mech,
@@ -137,8 +161,9 @@ apr_byte_t oidc_cache_mutex_post_config(apr_pool_t *pool, server_rec *s, oidc_ca
137161
apr_status_t rv = APR_SUCCESS;
138162

139163
if (m->is_global)
140-
return oidc_cache_mutex_global_create(s->process->pool, s, m, type);
164+
return oidc_cache_mutex_global_create(pool, s, m, type);
141165

166+
// NB: see note above at apr_global_mutex_create
142167
rv = apr_thread_mutex_create(&m->tmutex, APR_THREAD_MUTEX_DEFAULT, s->process->pool);
143168
if (rv != APR_SUCCESS) {
144169
oidc_serror(s, "apr_thread_mutex_create failed: %s (%d)", oidc_cache_status2str(pool, rv), rv);
@@ -162,7 +187,7 @@ apr_status_t oidc_cache_mutex_child_init(apr_pool_t *p, server_rec *s, oidc_cach
162187
apr_status_t rv = APR_SUCCESS;
163188

164189
if (m->is_global) {
165-
rv = apr_global_mutex_child_init(&m->gmutex, (const char *)m->mutex_filename, s->process->pool);
190+
rv = apr_global_mutex_child_init(&m->gmutex, (const char *)m->mutex_filename, p);
166191
if (rv != APR_SUCCESS) {
167192
oidc_serror(s,
168193
"apr_global_mutex_child_init failed to reopen mutex on "

src/cache/shm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int oidc_cache_shm_post_config(apr_pool_t *pool, server_rec *s) {
9595

9696
/* create the shared memory segment */
9797
apr_status_t rv = apr_shm_create(
98-
&context->shm, (apr_size_t)cfg->cache.shm_entry_size_max * cfg->cache.shm_size_max, NULL, s->process->pool);
98+
&context->shm, (apr_size_t)cfg->cache.shm_entry_size_max * cfg->cache.shm_size_max, NULL, pool);
9999
if (rv != APR_SUCCESS) {
100100
oidc_serror(s, "apr_shm_create failed to create shared memory segment");
101101
return HTTP_INTERNAL_SERVER_ERROR;

src/cfg/cfg.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,23 @@ OIDC_CFG_MEMBER_FUNCS_ABS_OR_REL_URI(redirect_uri)
684684
OIDC_CFG_MEMBER_FUNCS_ABS_OR_REL_URI(default_sso_url)
685685
OIDC_CFG_MEMBER_FUNCS_ABS_OR_REL_URI(default_slo_url)
686686

687+
typedef struct oidc_cfg_cleanup_ctx_t {
688+
oidc_cfg_t *cfg;
689+
apr_pool_t *pool;
690+
server_rec *svr;
691+
} oidc_cfg_cleanup_ctx_t;
692+
687693
/*
688694
* destroy a server config record and its members
689695
*/
690696
static apr_status_t oidc_cfg_server_destroy(void *data) {
691-
oidc_cfg_t *cfg = (oidc_cfg_t *)data;
697+
oidc_cfg_cleanup_ctx_t *ctx = (oidc_cfg_cleanup_ctx_t *)data;
698+
oidc_cfg_t *cfg = ctx->cfg;
699+
if (cfg->cache.impl && cfg->cache.impl->destroy) {
700+
cfg->cache.impl->destroy(ctx->pool, ctx->svr);
701+
cfg->cache.impl->destroy = NULL;
702+
cfg->cache.impl = NULL;
703+
}
692704
oidc_cfg_provider_destroy(cfg->provider);
693705
cfg->provider = NULL;
694706
oidc_cfg_oauth_destroy(cfg->oauth);
@@ -700,18 +712,24 @@ static apr_status_t oidc_cfg_server_destroy(void *data) {
700712
return APR_SUCCESS;
701713
}
702714

703-
static oidc_cfg_t *oidc_cfg_server_alloc(apr_pool_t *pool) {
715+
static oidc_cfg_t *oidc_cfg_server_alloc(apr_pool_t *pool, server_rec *svr) {
704716
oidc_cfg_t *c = apr_pcalloc(pool, sizeof(oidc_cfg_t));
717+
oidc_cfg_cleanup_ctx_t *ctx = apr_pcalloc(pool, sizeof(oidc_cfg_cleanup_ctx_t));
718+
ctx->cfg = c;
719+
// pool used at descrution time
720+
ctx->pool = pool;
721+
ctx->svr = svr;
705722
// need to register a cleanup handler to the config pool to handle graceful restarts without memory leaks
706-
apr_pool_cleanup_register(pool, c, oidc_cfg_server_destroy, oidc_cfg_server_destroy);
723+
apr_pool_cleanup_register(pool, ctx, oidc_cfg_server_destroy, oidc_cfg_server_destroy);
707724
return c;
708725
}
709726

710727
/*
711728
* create a new server config record with defaults
712729
*/
713730
void *oidc_cfg_server_create(apr_pool_t *pool, server_rec *svr) {
714-
oidc_cfg_t *c = oidc_cfg_server_alloc(pool);
731+
oidc_cfg_t *c = oidc_cfg_server_alloc(pool, svr);
732+
c->svr = svr;
715733

716734
c->merged = FALSE;
717735

@@ -797,7 +815,7 @@ void *oidc_cfg_server_merge(apr_pool_t *pool, void *BASE, void *ADD) {
797815
oidc_cfg_t *base = (oidc_cfg_t *)BASE;
798816
oidc_cfg_t *add = (oidc_cfg_t *)ADD;
799817

800-
oidc_cfg_t *c = oidc_cfg_server_alloc(pool);
818+
oidc_cfg_t *c = oidc_cfg_server_alloc(pool, add->svr);
801819

802820
c->provider = oidc_cfg_provider_create(pool);
803821
c->oauth = oidc_cfg_oauth_create(pool);
@@ -994,7 +1012,7 @@ int oidc_cfg_post_config(apr_pool_t *pool, oidc_cfg_t *cfg, server_rec *s) {
9941012
if (_oidc_refresh_mutex == NULL) {
9951013
// NB: use the process pool here as the mutex is a process-wide singleton
9961014
_oidc_refresh_mutex = oidc_cache_mutex_create(s->process->pool, TRUE);
997-
if (oidc_cache_mutex_post_config(pool, s, _oidc_refresh_mutex, "refresh") != TRUE)
1015+
if (oidc_cache_mutex_post_config(s->process->pool, s, _oidc_refresh_mutex, "refresh") != TRUE)
9981016
return HTTP_INTERNAL_SERVER_ERROR;
9991017
}
10001018
if (cfg->metrics_hook_data != NULL) {
@@ -1023,13 +1041,6 @@ void oidc_cfg_child_init(apr_pool_t *pool, oidc_cfg_t *cfg, server_rec *s) {
10231041
}
10241042

10251043
void oidc_cfg_cleanup_child(oidc_cfg_t *cfg, server_rec *s) {
1026-
// TODO: is the cache destroyed on graceful restarts now?
1027-
if (cfg->cache.impl->destroy != NULL) {
1028-
if (cfg->cache.impl->destroy(s->process->pool, s) != APR_SUCCESS) {
1029-
oidc_serror(s, "cache destroy function failed");
1030-
}
1031-
cfg->cache.impl->destroy = NULL;
1032-
}
10331044
if (_oidc_refresh_mutex != NULL) {
10341045
if (oidc_cache_mutex_destroy(s, _oidc_refresh_mutex) != TRUE) {
10351046
oidc_serror(s, "oidc_cache_mutex_destroy on refresh mutex failed");

src/cfg/cfg_int.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ struct oidc_cfg_cache_t {
115115

116116
struct oidc_cfg_t {
117117

118+
server_rec *svr;
119+
118120
/* the redirect URI as configured with the OpenID Connect OP's that we talk to */
119121
char *redirect_uri;
120122
/* secret key(s) used for encryption */

test/helper.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ static request_rec *oidc_test_request_init(apr_pool_t *pool) {
5454
const unsigned int kEls = kIdx + 1;
5555
request_rec *request = (request_rec *)apr_pcalloc(pool, sizeof(request_rec));
5656

57-
request->pool = pool;
57+
apr_pool_create(&request->pool, pool);
58+
5859
request->subprocess_env = apr_table_make(request->pool, 0);
5960

6061
request->headers_in = apr_table_make(request->pool, 0);
@@ -68,13 +69,13 @@ static request_rec *oidc_test_request_init(apr_pool_t *pool) {
6869
"mod_auth_openidc_session"
6970
"=0123456789abcdef; baz=zot");
7071

71-
request->server = apr_pcalloc(request->pool, sizeof(struct server_rec));
72-
request->server->process = apr_pcalloc(request->pool, sizeof(struct process_rec));
73-
request->server->process->pool = request->pool;
74-
request->server->process->pconf = request->pool;
75-
request->connection = apr_pcalloc(request->pool, sizeof(struct conn_rec));
76-
request->connection->bucket_alloc = apr_bucket_alloc_create(request->pool);
77-
request->connection->local_addr = apr_pcalloc(request->pool, sizeof(apr_sockaddr_t));
72+
request->server = apr_pcalloc(pool, sizeof(struct server_rec));
73+
request->server->process = apr_pcalloc(pool, sizeof(struct process_rec));
74+
apr_pool_create(&request->server->process->pool, pool);
75+
apr_pool_create(&request->server->process->pconf, pool);
76+
request->connection = apr_pcalloc(pool, sizeof(struct conn_rec));
77+
request->connection->bucket_alloc = apr_bucket_alloc_create(pool);
78+
request->connection->local_addr = apr_pcalloc(pool, sizeof(apr_sockaddr_t));
7879

7980
apr_pool_userdata_set("https", "scheme", NULL, request->pool);
8081
request->server->server_hostname = "www.example.com";
@@ -84,35 +85,36 @@ static request_rec *oidc_test_request_init(apr_pool_t *pool) {
8485
apr_uri_parse(request->pool, "https://www.example.com/bla?foo=bar&param1=value1", &request->parsed_uri);
8586

8687
auth_openidc_module.module_index = kIdx;
87-
oidc_cfg_t *cfg = oidc_cfg_server_create(request->pool, request->server);
88+
oidc_cfg_t *cfg = oidc_cfg_server_create(request->server->process->pconf, request->server);
8889

89-
oidc_cfg_provider_issuer_set(pool, oidc_cfg_provider_get(cfg), "https://idp.example.com");
90-
oidc_cfg_provider_authorization_endpoint_url_set(pool, oidc_cfg_provider_get(cfg),
90+
oidc_cfg_provider_issuer_set(request->server->process->pconf, oidc_cfg_provider_get(cfg),
91+
"https://idp.example.com");
92+
oidc_cfg_provider_authorization_endpoint_url_set(request->server->process->pconf, oidc_cfg_provider_get(cfg),
9193
"https://idp.example.com/authorize");
92-
oidc_cfg_provider_client_id_set(pool, oidc_cfg_provider_get(cfg), "client_id");
94+
oidc_cfg_provider_client_id_set(request->server->process->pconf, oidc_cfg_provider_get(cfg), "client_id");
9395

9496
cfg->redirect_uri = "https://www.example.com/protected/";
9597

96-
oidc_dir_cfg_t *d_cfg = oidc_cfg_dir_config_create(request->pool, NULL);
98+
oidc_dir_cfg_t *d_cfg = oidc_cfg_dir_config_create(request->server->process->pconf, NULL);
9799

98100
// coverity[suspicious_sizeof]
99-
request->server->module_config = apr_pcalloc(request->pool, sizeof(void *) * kEls);
101+
request->server->module_config = apr_pcalloc(request->server->process->pconf, sizeof(void *) * kEls);
100102
// coverity[suspicious_sizeof]
101-
request->per_dir_config = apr_pcalloc(request->pool, sizeof(void *) * kEls);
103+
request->per_dir_config = apr_pcalloc(request->server->process->pconf, sizeof(void *) * kEls);
102104
ap_set_module_config(request->server->module_config, &auth_openidc_module, cfg);
103105
ap_set_module_config(request->per_dir_config, &auth_openidc_module, d_cfg);
104106

105107
// TODO:
106-
cfg->public_keys = apr_array_make(pool, 1, sizeof(const char *));
107-
cfg->private_keys = apr_array_make(pool, 1, sizeof(const char *));
108+
cfg->public_keys = apr_array_make(request->server->process->pconf, 1, sizeof(const char *));
109+
cfg->private_keys = apr_array_make(request->server->process->pconf, 1, sizeof(const char *));
108110

109111
cfg->crypto_passphrase.secret1 = "12345678901234567890123456789012";
110112
cfg->cache.impl = &oidc_cache_shm;
111113
cfg->cache.cfg = NULL;
112114
cfg->cache.shm_size_max = 500;
113115
cfg->cache.shm_entry_size_max = 16384 + 255 + 17;
114116
cfg->cache.encrypt = 1;
115-
if (cfg->cache.impl->post_config(pool, request->server) != OK) {
117+
if (cfg->cache.impl->post_config(request->server->process->pconf, request->server) != OK) {
116118
fprintf(stderr, "cfg->cache.impl->post_config failed!\n");
117119
exit(-1);
118120
}
@@ -129,8 +131,6 @@ void oidc_test_setup(void) {
129131

130132
void oidc_test_teardown(void) {
131133
EVP_cleanup();
132-
oidc_test_cfg_get()->cache.impl->destroy(pool, request->server);
133-
apr_pool_destroy(pool);
134134
apr_terminate();
135135
}
136136

test/test-cmd.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ static request_rec *request_setup(apr_pool_t *pool) {
293293

294294
request->server = apr_pcalloc(request->pool, sizeof(struct server_rec));
295295
request->server->process = apr_pcalloc(request->pool, sizeof(struct process_rec));
296-
request->server->process->pool = request->pool;
297-
request->server->process->pconf = request->pool;
296+
apr_pool_create(&request->server->process->pool, pool);
297+
apr_pool_create(&request->server->process->pconf, pool);
298298
request->connection = apr_pcalloc(request->pool, sizeof(struct conn_rec));
299299
request->connection->local_addr = apr_pcalloc(request->pool, sizeof(apr_sockaddr_t));
300300

@@ -306,27 +306,28 @@ static request_rec *request_setup(apr_pool_t *pool) {
306306
apr_uri_parse(request->pool, "https://www.example.com/bla?foo=bar&param1=value1", &request->parsed_uri);
307307

308308
auth_openidc_module.module_index = kIdx;
309-
oidc_cfg_t *cfg = oidc_cfg_server_create(request->pool, request->server);
309+
oidc_cfg_t *cfg = oidc_cfg_server_create(request->server->process->pconf, request->server);
310310

311-
oidc_cfg_provider_issuer_set(pool, oidc_cfg_provider_get(cfg), "https://idp.example.com");
312-
oidc_cfg_provider_authorization_endpoint_url_set(pool, oidc_cfg_provider_get(cfg),
311+
oidc_cfg_provider_issuer_set(request->server->process->pconf, oidc_cfg_provider_get(cfg),
312+
"https://idp.example.com");
313+
oidc_cfg_provider_authorization_endpoint_url_set(request->server->process->pconf, oidc_cfg_provider_get(cfg),
313314
"https://idp.example.com/authorize");
314-
oidc_cfg_provider_scope_set(pool, oidc_cfg_provider_get(cfg), "openid");
315-
oidc_cfg_provider_client_id_set(pool, oidc_cfg_provider_get(cfg), "client_id");
315+
oidc_cfg_provider_scope_set(request->server->process->pconf, oidc_cfg_provider_get(cfg), "openid");
316+
oidc_cfg_provider_client_id_set(request->server->process->pconf, oidc_cfg_provider_get(cfg), "client_id");
316317
cfg->redirect_uri = "https://www.example.com/protected/";
317318

318-
oidc_dir_cfg_t *d_cfg = oidc_cfg_dir_config_create(request->pool, NULL);
319+
oidc_dir_cfg_t *d_cfg = oidc_cfg_dir_config_create(request->server->process->pconf, NULL);
319320

320-
request->server->module_config = apr_pcalloc(request->pool, sizeof(void) * kEls);
321-
request->per_dir_config = apr_pcalloc(request->pool, sizeof(void) * kEls);
321+
request->server->module_config = apr_pcalloc(request->server->process->pconf, sizeof(void) * kEls);
322+
request->per_dir_config = apr_pcalloc(request->server->process->pconf, sizeof(void) * kEls);
322323
ap_set_module_config(request->server->module_config, &auth_openidc_module, cfg);
323324
ap_set_module_config(request->per_dir_config, &auth_openidc_module, d_cfg);
324325

325326
cfg->cache.impl = &oidc_cache_shm;
326327
cfg->cache.cfg = NULL;
327328
cfg->cache.shm_size_max = 500;
328329
cfg->cache.shm_entry_size_max = 16384 + 255 + 17;
329-
if (cfg->cache.impl->post_config(pool, request->server) != OK) {
330+
if (oidc_cfg_post_config(request->server->process->pconf, cfg, request->server) != OK) {
330331
printf("cfg->cache->post_config failed!\n");
331332
exit(-1);
332333
}
@@ -494,8 +495,6 @@ int main(int argc, char **argv, char **env) {
494495
return uuid(argc, argv, pool);
495496

496497
EVP_cleanup();
497-
498-
apr_pool_destroy(pool);
499498
apr_terminate();
500499

501500
return usage(argc, argv, NULL);

test/test.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ static request_rec *test_setup(apr_pool_t *pool) {
14241424
const unsigned int kEls = kIdx + 1;
14251425
request_rec *request = (request_rec *)apr_pcalloc(pool, sizeof(request_rec));
14261426

1427-
request->pool = pool;
1427+
apr_pool_create(&request->pool, pool);
14281428
request->subprocess_env = apr_table_make(request->pool, 0);
14291429

14301430
request->headers_in = apr_table_make(request->pool, 0);
@@ -1440,8 +1440,8 @@ static request_rec *test_setup(apr_pool_t *pool) {
14401440

14411441
request->server = apr_pcalloc(request->pool, sizeof(struct server_rec));
14421442
request->server->process = apr_pcalloc(request->pool, sizeof(struct process_rec));
1443-
request->server->process->pool = request->pool;
1444-
request->server->process->pconf = request->pool;
1443+
apr_pool_create(&request->server->process->pool, pool);
1444+
apr_pool_create(&request->server->process->pconf, pool);
14451445
request->connection = apr_pcalloc(request->pool, sizeof(struct conn_rec));
14461446
request->connection->bucket_alloc = apr_bucket_alloc_create(request->pool);
14471447
request->connection->local_addr = apr_pcalloc(request->pool, sizeof(apr_sockaddr_t));
@@ -1454,21 +1454,22 @@ static request_rec *test_setup(apr_pool_t *pool) {
14541454
apr_uri_parse(request->pool, "https://www.example.com/bla?foo=bar&param1=value1", &request->parsed_uri);
14551455

14561456
auth_openidc_module.module_index = kIdx;
1457-
oidc_cfg_t *cfg = oidc_cfg_server_create(request->pool, request->server);
1457+
oidc_cfg_t *cfg = oidc_cfg_server_create(request->server->process->pconf, request->server);
14581458

1459-
oidc_cfg_provider_issuer_set(pool, oidc_cfg_provider_get(cfg), "https://idp.example.com");
1460-
oidc_cfg_provider_authorization_endpoint_url_set(pool, oidc_cfg_provider_get(cfg),
1459+
oidc_cfg_provider_issuer_set(request->server->process->pconf, oidc_cfg_provider_get(cfg),
1460+
"https://idp.example.com");
1461+
oidc_cfg_provider_authorization_endpoint_url_set(request->server->process->pconf, oidc_cfg_provider_get(cfg),
14611462
"https://idp.example.com/authorize");
1462-
oidc_cfg_provider_client_id_set(pool, oidc_cfg_provider_get(cfg), "client_id");
1463+
oidc_cfg_provider_client_id_set(request->server->process->pconf, oidc_cfg_provider_get(cfg), "client_id");
14631464

14641465
cfg->redirect_uri = "https://www.example.com/protected/";
14651466

1466-
oidc_dir_cfg_t *d_cfg = oidc_cfg_dir_config_create(request->pool, NULL);
1467+
oidc_dir_cfg_t *d_cfg = oidc_cfg_dir_config_create(request->server->process->pconf, NULL);
14671468

14681469
// coverity[suspicious_sizeof]
1469-
request->server->module_config = apr_pcalloc(request->pool, sizeof(void *) * kEls);
1470+
request->server->module_config = apr_pcalloc(request->server->process->pconf, sizeof(void *) * kEls);
14701471
// coverity[suspicious_sizeof]
1471-
request->per_dir_config = apr_pcalloc(request->pool, sizeof(void *) * kEls);
1472+
request->per_dir_config = apr_pcalloc(request->server->process->pconf, sizeof(void *) * kEls);
14721473
ap_set_module_config(request->server->module_config, &auth_openidc_module, cfg);
14731474
ap_set_module_config(request->per_dir_config, &auth_openidc_module, d_cfg);
14741475

@@ -1478,7 +1479,7 @@ static request_rec *test_setup(apr_pool_t *pool) {
14781479
cfg->cache.shm_size_max = 500;
14791480
cfg->cache.shm_entry_size_max = 16384 + 255 + 17;
14801481
cfg->cache.encrypt = 1;
1481-
if (oidc_cfg_post_config(pool, cfg, request->server) != OK) {
1482+
if (oidc_cfg_post_config(request->server->process->pconf, cfg, request->server) != OK) {
14821483
printf("cfg->cache.impl->post_config failed!\n");
14831484
exit(-1);
14841485
}
@@ -1506,7 +1507,6 @@ int main(int argc, char **argv, char **env) {
15061507
}
15071508

15081509
EVP_cleanup();
1509-
apr_pool_destroy(pool);
15101510
apr_terminate();
15111511

15121512
return result != 0;

0 commit comments

Comments
 (0)