Skip to content

Commit

Permalink
lightningd/plugin: free timers struct after use.
Browse files Browse the repository at this point in the history
It's actually a local variable, so make it one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jun 12, 2019
1 parent 802ab87 commit 1604569
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ struct plugins {
struct log *log;
struct log_book *log_book;

struct timers timers;
struct lightningd *ld;
};

Expand Down Expand Up @@ -107,7 +106,6 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
list_head_init(&p->plugins);
p->log_book = log_book;
p->log = new_log(p, log_book, "plugin-manager");
timers_init(&p->timers, time_mono());
p->ld = ld;
return p;
}
Expand Down Expand Up @@ -965,8 +963,11 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
int stdin, stdout;
struct timer *expired;
struct jsonrpc_request *req;
struct timers timers;

plugins->pending_manifests = 0;
uintmap_init(&plugins->pending_requests);
timers_init(&timers, time_mono());

plugins_add_default_dir(plugins, path_join(tmpctx, plugins->ld->config_dir, "plugins"));

Expand Down Expand Up @@ -1003,19 +1004,20 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
p->timeout_timer = NULL;
else {
p->timeout_timer
= new_reltimer(&plugins->timers, p,
= new_reltimer(&timers, p,
time_from_sec(PLUGIN_MANIFEST_TIMEOUT),
plugin_manifest_timeout, p);
}
tal_free(cmd);
}
while (plugins->pending_manifests > 0) {
void *v = io_loop(&plugins->timers, &expired);
void *v = io_loop(&timers, &expired);
if (v == plugins)
break;
if (expired)
timer_expired(plugins, expired);
}
timers_cleanup(&timers);
}

static void plugin_config_cb(const char *buffer,
Expand Down

0 comments on commit 1604569

Please sign in to comment.