plugin: autoclean fix double free when re-enable, remove xfail mark from test_

Fixes a crash when enabling after a disable with cycle_seconds=0.
This commit is contained in:
Simon Vrouwe
2022-07-14 12:40:11 +03:00
committed by Rusty Russell
parent cc40243399
commit ad3cbed7c2
2 changed files with 3 additions and 2 deletions

View File

@@ -48,12 +48,14 @@ static struct command_result *json_autocleaninvoice(struct command *cmd,
cycle_seconds = *cycle;
expired_by = *exby;
cleantimer = tal_free(cleantimer);
if (cycle_seconds == 0) {
response = jsonrpc_stream_success(cmd);
json_add_bool(response, "enabled", false);
return command_finished(cmd, response);
}
tal_free(cleantimer);
cleantimer = plugin_timer(cmd->plugin, time_from_sec(cycle_seconds),
do_clean, cmd->plugin);