summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2014-06-24 08:24:29 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2014-06-24 08:24:29 +0000
commitd7c779cdbfbd8248b43ebc28469200679deaabf2 (patch)
tree1021075a73fac339f3bc2e9816fc85b7e31241ef
parent519f22493ebed5bcb64f25066412a2894d7a372e (diff)
downloadmod_auth_mellon-d7c779cdbfbd8248b43ebc28469200679deaabf2.zip
mod_auth_mellon-d7c779cdbfbd8248b43ebc28469200679deaabf2.tar.gz
mod_auth_mellon-d7c779cdbfbd8248b43ebc28469200679deaabf2.tar.xz
Fix memory leak of loaded IdPs.
We free the first element of a linked list, but not the data nor the subsequent elements. Fix that by first iterating through the list freeing the elements and then freeing the list using g_list_free(). We could have used g_list_free_full, but that requires version 2.28 of GLib, which is still slightly too recent. git-svn-id: https://modmellon.googlecode.com/svn/trunk@237 a716ebb1-153a-0410-b759-cfb97c6a1b53
-rw-r--r--auth_mellon_handler.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
index 1de217a..2a0bd74 100644
--- a/auth_mellon_handler.c
+++ b/auth_mellon_handler.c
@@ -256,8 +256,12 @@ static guint am_server_add_providers(am_dir_cfg_rec *cfg, request_rec *r)
}
}
- if (loaded_idp != NULL)
- g_free(loaded_idp);
+ if (loaded_idp != NULL) {
+ for (GList *idx = loaded_idp; idx != NULL; idx = idx->next) {
+ g_free(idx->data);
+ }
+ g_list_free(loaded_idp);
+ }
#else /* HAVE_lasso_server_load_metadata */
error = lasso_server_add_provider(cfg->server,