Fix leak of lasso_server objects.

Unfortunately, the lasso_server objects were never destroyed, which
led to a memory leak when using request-specific configuration.

git-svn-id: https://modmellon.googlecode.com/svn/trunk/mod_mellon2@118 a716ebb1-153a-0410-b759-cfb97c6a1b53
This commit is contained in:
olavmrk 2011-03-30 07:40:15 +00:00
parent e95de17171
commit 576c273226
1 changed files with 27 additions and 0 deletions

View File

@ -1006,6 +1006,27 @@ const command_rec auth_mellon_commands[] = {
};
/* Release a lasso_server object associated with this configuration.
*
* Parameters:
* void *data The pointer to the configuration data.
*
* Returns:
* Always APR_SUCCESS.
*/
static apr_status_t auth_mellon_free_server(void *data)
{
am_dir_cfg_rec *dir = data;
if (dir->server != NULL) {
lasso_server_destroy(dir->server);
dir->server = NULL;
}
return APR_SUCCESS;
}
/* This function creates and initializes a directory configuration
* object for auth_mellon.
*
@ -1020,6 +1041,9 @@ void *auth_mellon_dir_config(apr_pool_t *p, char *d)
{
am_dir_cfg_rec *dir = apr_palloc(p, sizeof(*dir));
apr_pool_cleanup_register(p, dir, auth_mellon_free_server,
auth_mellon_free_server);
dir->enable_mellon = am_enable_default;
dir->decoder = am_decoder_default;
@ -1081,6 +1105,9 @@ void *auth_mellon_dir_merge(apr_pool_t *p, void *base, void *add)
new_cfg = (am_dir_cfg_rec *)apr_palloc(p, sizeof(*new_cfg));
apr_pool_cleanup_register(p, new_cfg, auth_mellon_free_server,
auth_mellon_free_server);
new_cfg->enable_mellon = (add_cfg->enable_mellon != am_enable_default ?
add_cfg->enable_mellon :