mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
peer_control: fix leak false positive.
We generally hang things off our JSON response (this pattern predates tmpctx!) but sometimes it gets reported as a memleak. I'd prefer not to mark JSON responses as "notleak", since they can be allocated for a while), so use tmpctx here. ``` E ValueError: E Node errors: E Global errors: E - Node /tmp/ltests-spnausnb/test_htlc_out_timeout_1/lightning-1/ has memory leaks: [ E { E "backtrace": [ E "ccan/ccan/tal/tal.c:442 (tal_alloc_)", E "ccan/ccan/tal/tal.c:471 (tal_alloc_arr_)", E "wallet/wallet.c:1775 (wallet_state_change_get)", E "lightningd/peer_control.c:922 (json_add_channel)", E "lightningd/peer_control.c:1424 (json_add_peer)", E "lightningd/peer_control.c:1454 (json_listpeers)", E "lightningd/jsonrpc.c:643 (command_exec)", E "lightningd/jsonrpc.c:767 (rpc_command_hook_final)", E "lightningd/plugin_hook.c:275 (plugin_hook_call_)", E "lightningd/jsonrpc.c:855 (plugin_hook_call_rpc_command)", E "lightningd/jsonrpc.c:942 (parse_request)", E "lightningd/jsonrpc.c:1033 (read_json)", E "ccan/ccan/io/io.c:59 (next_plan)", E "ccan/ccan/io/io.c:435 (io_do_always)", E "ccan/ccan/io/poll.c:300 (handle_always)", E "ccan/ccan/io/poll.c:377 (io_loop)", E "lightningd/io_loop_with_timers.c:24 (io_loop_with_timers)", E "lightningd/lightningd.c:1097 (main)" E ], E "label": "wallet/wallet.c:1775:struct state_change_entry[]", E "parents": [ E "common/json_stream.c:29:struct json_stream", E "ccan/ccan/io/io.c:91:struct io_conn", E "lightningd/lightningd.c:116:struct lightningd" E ], E "value": "0x55c6b02150b8" E } E ] ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
8cef2c17ad
commit
ade10e7fc4
@ -919,7 +919,7 @@ static void json_add_channel(struct lightningd *ld,
|
||||
json_add_num(response, "max_accepted_htlcs",
|
||||
channel->our_config.max_accepted_htlcs);
|
||||
|
||||
state_changes = wallet_state_change_get(ld->wallet, response, channel->dbid);
|
||||
state_changes = wallet_state_change_get(ld->wallet, tmpctx, channel->dbid);
|
||||
json_array_start(response, "state_changes");
|
||||
for (size_t i = 0; i < tal_count(state_changes); i++) {
|
||||
json_object_start(response, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user