Skip to content

Commit

Permalink
Fix am_mod_cfg_rec not being reused.(latchset#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
oss-aimoto committed Sep 18, 2020
1 parent da32cf2 commit 0059d43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions auth_mellon_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2207,14 +2207,14 @@ void *auth_mellon_server_config(apr_pool_t *p, server_rec *s)
/* we want to keeep our global configuration of shared memory and
* mutexes, so we try to find it in the userdata before doing anything
* else */
apr_pool_userdata_get((void **)&mod, key, p);
apr_pool_userdata_get((void **)&mod, key, s->process->pool);
if (mod) {
srv->mc = mod;
return srv;
}

/* the module has not been initiated at all */
mod = apr_palloc(p, sizeof(*mod));
mod = apr_palloc(s->process->pool, sizeof(*mod));

mod->cache_size = 100; /* ought to be enough for everybody */
mod->lock_file = "/var/run/mod_auth_mellon.lock";
Expand All @@ -2232,7 +2232,7 @@ void *auth_mellon_server_config(apr_pool_t *p, server_rec *s)
mod->cache = NULL;
mod->lock = NULL;

apr_pool_userdata_set(mod, key, apr_pool_cleanup_null, p);
apr_pool_userdata_set(mod, key, apr_pool_cleanup_null, s->process->pool);

srv->mc = mod;

Expand Down
6 changes: 3 additions & 3 deletions mod_auth_mellon.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static int am_global_init(apr_pool_t *conf, apr_pool_t *log,
* initialized.
*/
mod->init_cache_size = mod->cache_size;
mod->init_lock_file = apr_pstrdup(conf, mod->lock_file);
mod->init_lock_file = apr_pstrdup(s->process->pool, mod->lock_file);
mod->init_entry_size = mod->entry_size;
if (mod->init_entry_size < AM_CACHE_MIN_ENTRY_SIZE) {
mod->init_entry_size = AM_CACHE_MIN_ENTRY_SIZE;
Expand All @@ -100,7 +100,7 @@ static int am_global_init(apr_pool_t *conf, apr_pool_t *log,


/* Create the shared memory, exit if it fails. */
rv = apr_shm_create(&(mod->cache), mem_size, NULL, conf);
rv = apr_shm_create(&(mod->cache), mem_size, NULL, s->process->pool);

if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
Expand All @@ -117,7 +117,7 @@ static int am_global_init(apr_pool_t *conf, apr_pool_t *log,
rv = apr_global_mutex_create(&(mod->lock),
mod->init_lock_file,
APR_LOCK_DEFAULT,
conf);
s->process->pool);

if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
Expand Down

0 comments on commit 0059d43

Please sign in to comment.