Browse Source

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>
travis-debug
Rusty Russell 5 years ago
committed by neil saitug
parent
commit
034ed1711c
  1. 2
      gossipd/gossipd.c

2
gossipd/gossipd.c

@ -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];

Loading…
Cancel
Save