mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
libplugin: handle JSON reply after command freed.
This can happen, and in fact does below in our test_autoclean_once test where we update the datastore, and return from the cmd. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4693803c35
commit
41a52929f7
1 changed files with 5 additions and 2 deletions
|
@ -681,10 +681,13 @@ static void handle_rpc_reply(struct plugin *plugin, const jsmntok_t *toks)
|
|||
out = strmap_getn(&plugin->out_reqs,
|
||||
plugin->rpc_buffer + idtok->start,
|
||||
idtok->end - idtok->start);
|
||||
if (!out)
|
||||
plugin_err(plugin, "JSON reply with unknown id '%.*s'",
|
||||
if (!out) {
|
||||
/* This can actually happen, if they free req! */
|
||||
plugin_log(plugin, LOG_DBG, "JSON reply with unknown id '%.*s'",
|
||||
json_tok_full_len(toks),
|
||||
json_tok_full(plugin->rpc_buffer, toks));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Remove destructor if one existed */
|
||||
if (out->cmd)
|
||||
|
|
Loading…
Add table
Reference in a new issue