mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-03 21:24:22 +01:00
gossipd: fix memleak when we getnodes has no nodes.
In this case, node_arr is NULL. Triggered by the next test. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
150598e061
commit
034ed1711c
@@ -1126,7 +1126,7 @@ static struct io_plan *getnodes(struct io_conn *conn, struct daemon *daemon,
|
||||
}
|
||||
|
||||
/* FIXME: towire wants array of pointers. */
|
||||
nodes = tal_arr(node_arr, const struct gossip_getnodes_entry *,
|
||||
nodes = tal_arr(tmpctx, const struct gossip_getnodes_entry *,
|
||||
tal_count(node_arr));
|
||||
for (size_t i = 0; i < tal_count(node_arr); i++)
|
||||
nodes[i] = &node_arr[i];
|
||||
|
||||
Reference in New Issue
Block a user