Skip to content

Commit 802ab87

Browse files
committed
lightningd: free strmap of commands on shutdown.
Indirect leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f4c84ce4448 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10c448) #1 0x55d11b77d270 in strmap_add_ ccan/ccan/strmap/strmap.c:90 #2 0x55d11b704603 in command_set_usage lightningd/jsonrpc.c:891 #3 0x55d11b733cb5 in param common/param.c:295 #4 0x55d11b6f7b37 in json_connect lightningd/connect_control.c:96 #5 0x55d11b7042ef in setup_command_usage lightningd/jsonrpc.c:841 #6 0x55d11b70443b in jsonrpc_command_add_perm lightningd/jsonrpc.c:863 #7 0x55d11b704533 in jsonrpc_setup lightningd/jsonrpc.c:876 #8 0x55d11b705695 in new_lightningd lightningd/lightningd.c:210 #9 0x55d11b706062 in main lightningd/lightningd.c:644 #10 0x7f4c84696b6a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26b6a) Signed-off-by: Rusty Russell <[email protected]>
1 parent 8b9e486 commit 802ab87

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lightningd/jsonrpc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,11 @@ static bool jsonrpc_command_add_perm(struct lightningd *ld,
864864
return true;
865865
}
866866

867+
static void destroy_jsonrpc(struct jsonrpc *jsonrpc)
868+
{
869+
strmap_clear(&jsonrpc->usagemap);
870+
}
871+
867872
void jsonrpc_setup(struct lightningd *ld)
868873
{
869874
struct json_command **commands = get_cmdlist();
@@ -878,6 +883,7 @@ void jsonrpc_setup(struct lightningd *ld)
878883
commands[i]->name);
879884
}
880885
ld->jsonrpc->rpc_listener = NULL;
886+
tal_add_destructor(ld->jsonrpc, destroy_jsonrpc);
881887
}
882888

883889
bool command_usage_only(const struct command *cmd)

0 commit comments

Comments
 (0)