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
This commit is contained in:
olavmrk 2014-06-24 08:24:29 +00:00
parent 519f22493e
commit d7c779cdbf
1 changed files with 6 additions and 2 deletions

View File

@ -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,