plugin: use tll_free_and_free() to free the global plugin list

This commit is contained in:
Daniel Eklöf 2019-01-12 21:16:13 +01:00
parent aa6ea602ca
commit aa4fede306

View file

@ -17,20 +17,23 @@ struct plugin {
static tll(struct plugin) libs = tll_init();
static void __attribute__((destructor))
fini(void)
static void
free_lib(struct plugin plug)
{
tll_foreach(libs, plug) {
dlerror();
dlclose(plug->item.lib);
dlclose(plug.lib);
const char *dl_error = dlerror();
if (dl_error != NULL)
LOG_ERR("%s: dlclose(): %s", plug->item.name, dl_error);
LOG_ERR("%s: dlclose(): %s", plug.name, dl_error);
free(plug->item.name);
tll_remove(libs, plug);
free(plug.name);
}
static void __attribute__((destructor))
fini(void)
{
tll_free_and_free(libs, free_lib);
}
const struct module_info *