mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +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:
committed by
Christian Decker
parent
4693803c35
commit
41a52929f7
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user