diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 2a60b6b0c..8342c5161 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1434,10 +1434,10 @@ void peer_connected(struct lightningd *ld, const u8 *msg) peer = peer_by_id(ld, &id); if (!peer) peer = new_peer(ld, 0, &id, &hook_payload->addr, - their_features, hook_payload->incoming); + take(their_features), hook_payload->incoming); else { tal_free(peer->their_features); - peer->their_features = tal_dup_talarr(peer, u8, their_features); + peer->their_features = tal_steal(peer, their_features); } /* We track this, because messages can race between connectd and us. diff --git a/lightningd/peer_control.h b/lightningd/peer_control.h index b9c0f3d10..9c69faac3 100644 --- a/lightningd/peer_control.h +++ b/lightningd/peer_control.h @@ -73,7 +73,7 @@ struct peer *find_peer_by_dbid(struct lightningd *ld, u64 dbid); struct peer *new_peer(struct lightningd *ld, u64 dbid, const struct node_id *id, const struct wireaddr_internal *addr, - const u8 *their_features, + const u8 *their_features TAKES, bool connected_incoming); /* Last one out deletes peer. Also removes from db. */