mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
topology: fix memleak in listchannels
local_connected allocates a struct node_map off of the struct listchannels_opts but fails to ever release the internal table, so those table allocations hang around forever. Add node_map_clear as a destructor for the struct node_map to ensure that the internal table is freed when the enclosing struct is freed. Changelog-Fixed: topology: Fixed memleak in `listchannels` Signed-off-by: Matt Whitlock <c-lightning@mattwhitlock.name>
This commit is contained in:
parent
22eac96750
commit
9d5eab1b69
@ -305,6 +305,7 @@ static struct node_map *local_connected(const tal_t *ctx,
|
|||||||
struct node_map *connected = tal(ctx, struct node_map);
|
struct node_map *connected = tal(ctx, struct node_map);
|
||||||
|
|
||||||
node_map_init(connected);
|
node_map_init(connected);
|
||||||
|
tal_add_destructor(connected, node_map_clear);
|
||||||
|
|
||||||
json_for_each_arr(i, t, peers) {
|
json_for_each_arr(i, t, peers) {
|
||||||
const jsmntok_t *chans, *c;
|
const jsmntok_t *chans, *c;
|
||||||
|
Loading…
Reference in New Issue
Block a user