Skip to content

Commit

Permalink
lightningd/plugin: unregister plugin's options at destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
darosior committed Feb 4, 2020
1 parent 7ad6444 commit b5f41a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,

static void destroy_plugin(struct plugin *p)
{
struct plugin_opt *opt;

list_for_each(&p->plugin_opts, opt, list)
opt_unregister(opt->name);
plugin_hook_unregister_all(p);
list_del(&p->list);
}
Expand Down Expand Up @@ -487,7 +491,7 @@ static bool plugin_opt_add(struct plugin *plugin, const char *buffer,
popt = tal(plugin, struct plugin_opt);
popt->value = talz(popt, struct plugin_opt_value);

popt->name = tal_fmt(plugin, "--%.*s", nametok->end - nametok->start,
popt->name = tal_fmt(popt, "--%.*s", nametok->end - nametok->start,
buffer + nametok->start);
if (json_tok_streq(buffer, typetok, "string")) {
popt->type = "string";
Expand Down

0 comments on commit b5f41a9

Please sign in to comment.