mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-22 12:25:38 +02:00
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
25
plugin.c
25
plugin.c
|
@ -17,20 +17,23 @@ struct plugin {
|
||||||
|
|
||||||
static tll(struct plugin) libs = tll_init();
|
static tll(struct plugin) libs = tll_init();
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_lib(struct plugin plug)
|
||||||
|
{
|
||||||
|
dlerror();
|
||||||
|
dlclose(plug.lib);
|
||||||
|
|
||||||
|
const char *dl_error = dlerror();
|
||||||
|
if (dl_error != NULL)
|
||||||
|
LOG_ERR("%s: dlclose(): %s", plug.name, dl_error);
|
||||||
|
|
||||||
|
free(plug.name);
|
||||||
|
}
|
||||||
|
|
||||||
static void __attribute__((destructor))
|
static void __attribute__((destructor))
|
||||||
fini(void)
|
fini(void)
|
||||||
{
|
{
|
||||||
tll_foreach(libs, plug) {
|
tll_free_and_free(libs, free_lib);
|
||||||
dlerror();
|
|
||||||
dlclose(plug->item.lib);
|
|
||||||
|
|
||||||
const char *dl_error = dlerror();
|
|
||||||
if (dl_error != NULL)
|
|
||||||
LOG_ERR("%s: dlclose(): %s", plug->item.name, dl_error);
|
|
||||||
|
|
||||||
free(plug->item.name);
|
|
||||||
tll_remove(libs, plug);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info *
|
const struct module_info *
|
||||||
|
|
Loading…
Add table
Reference in a new issue