plugins: Fix undefined deallocation order in struct plugins

We use the new function `plugins_free` to define the correct deallocation
order on shutdown, since under normal operation the allocation tree is
organized to allow plugins to terminate and automatically free all dependent
resources. During shutdown the deallocation order is under-defined since
siblings may get freed in any order, but we implicitly rely on them staying
around.
This commit is contained in:
Christian Decker
2020-04-12 15:42:41 +02:00
committed by Rusty Russell
parent 284bd7de0c
commit 27ea47ae37
4 changed files with 37 additions and 1 deletions

View File

@@ -997,7 +997,7 @@ int main(int argc, char *argv[])
shutdown_subdaemons(ld);
/* Remove plugins. */
ld->plugins = tal_free(ld->plugins);
plugins_free(ld->plugins);
/* Clean up the JSON-RPC. This needs to happen in a DB transaction since
* it might actually be touching the DB in some destructors, e.g.,