forked from external/yambar
plugin: use tll_free_and_free() to free the global plugin list
This commit is contained in:
parent
aa6ea602ca
commit
aa4fede306
1 changed files with 14 additions and 11 deletions
17
plugin.c
17
plugin.c
|
@ -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 *
|
||||
|
|
Loading…
Add table
Reference in a new issue