Skip to content

Commit 838400c

Browse files
rustyrussellniftynei
authored andcommitted
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 <[email protected]>
1 parent 4249c61 commit 838400c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

plugins/libplugin.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,14 @@ static void handle_rpc_reply(struct plugin *plugin, const jsmntok_t *toks)
669669
json_tok_full_len(toks),
670670
json_tok_full(plugin->rpc_buffer, toks));
671671
out = uintmap_get(&plugin->out_reqs, id);
672-
if (!out)
673-
plugin_err(plugin, "JSON reply with unknown id '%.*s' (%"PRIu64")",
672+
if (!out) {
673+
/* This can actually happen, if they free req! */
674+
plugin_log(plugin, LOG_DBG, "JSON reply with unknown id '%.*s' (%"PRIu64")",
674675
json_tok_full_len(toks),
675-
json_tok_full(plugin->rpc_buffer, toks), id);
676+
json_tok_full(plugin->rpc_buffer, toks),
677+
id);
678+
return;
679+
}
676680

677681
/* Remove destructor if one existed */
678682
if (out->cmd)

0 commit comments

Comments
 (0)