summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2011-03-30 07:40:15 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2011-03-30 07:40:15 +0000
commit7be0942eb04528eec300a04f55aa0ecd0a05a486 (patch)
tree556243b6f057c0edd812a4c67e770ad6378cec04
parentf0467bab7c76db8b5989515da004931cfbca9837 (diff)
downloadmod_auth_mellon-7be0942eb04528eec300a04f55aa0ecd0a05a486.tar.gz
mod_auth_mellon-7be0942eb04528eec300a04f55aa0ecd0a05a486.tar.xz
mod_auth_mellon-7be0942eb04528eec300a04f55aa0ecd0a05a486.zip
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@118 a716ebb1-153a-0410-b759-cfb97c6a1b53
-rw-r--r--auth_mellon_config.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/auth_mellon_config.c b/auth_mellon_config.c
index 2e740f6..52e80b2 100644
--- a/auth_mellon_config.c
+++ b/auth_mellon_config.c
@@ -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 :