mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
plugins/spender: don't use global tal context, use take() instead.
Otherwise it looks like a leak. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
f246896348
commit
02553aa68a
1 changed files with 4 additions and 6 deletions
|
@ -18,30 +18,28 @@ const char *spender_init(struct plugin *p, const char *b, const jsmntok_t *t)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *owner = tal(NULL, char);
|
||||
struct plugin_command *commands;
|
||||
struct plugin_notification *notifs;
|
||||
|
||||
setup_locale();
|
||||
|
||||
commands = tal_arr(owner, struct plugin_command, 0);
|
||||
commands = tal_arr(NULL, struct plugin_command, 0);
|
||||
|
||||
tal_expand(&commands, multiwithdraw_commands, num_multiwithdraw_commands);
|
||||
tal_expand(&commands, fundchannel_commands, num_fundchannel_commands);
|
||||
tal_expand(&commands, multifundchannel_commands, num_multifundchannel_commands);
|
||||
/* tal_expand(&commands, whatever_commands, num_whatever_commands); */
|
||||
|
||||
notifs = tal_arr(owner, struct plugin_notification, 0);
|
||||
notifs = tal_arr(NULL, struct plugin_notification, 0);
|
||||
tal_expand(¬ifs, openchannel_notifs, num_openchannel_notifs);
|
||||
|
||||
plugin_main(argv, &spender_init, PLUGIN_STATIC, true,
|
||||
NULL,
|
||||
commands, tal_count(commands),
|
||||
notifs, tal_count(notifs),
|
||||
take(commands), tal_count(commands),
|
||||
take(notifs), tal_count(notifs),
|
||||
NULL, 0,
|
||||
NULL, 0, /* Notification topics */
|
||||
NULL);
|
||||
|
||||
tal_free(owner);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue