From d7c779cdbfbd8248b43ebc28469200679deaabf2 Mon Sep 17 00:00:00 2001 From: olavmrk Date: Tue, 24 Jun 2014 08:24:29 +0000 Subject: 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 --- auth_mellon_handler.c | 8 ++++++-- 1 file 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, -- cgit