mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-06 06:34:22 +01:00
lightingd: fix memleak when we reload from db.
We always arm the funding_lockin_cb, even if we don't need to. If we have an short_channel_id already from the db, this was replacing it and leaking the old one. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
fb81e6c14b
commit
ee939c8dcb
@@ -1502,10 +1502,13 @@ static enum watch_result funding_lockin_cb(struct peer *peer,
|
||||
|
||||
loc = locate_tx(peer, peer->ld->topology, &txid);
|
||||
|
||||
peer->scid = tal(peer, struct short_channel_id);
|
||||
peer->scid->blocknum = loc->blkheight;
|
||||
peer->scid->txnum = loc->index;
|
||||
peer->scid->outnum = peer->funding_outnum;
|
||||
/* If we restart, we could already have peer->scid from database */
|
||||
if (!peer->scid) {
|
||||
peer->scid = tal(peer, struct short_channel_id);
|
||||
peer->scid->blocknum = loc->blkheight;
|
||||
peer->scid->txnum = loc->index;
|
||||
peer->scid->outnum = peer->funding_outnum;
|
||||
}
|
||||
tal_free(loc);
|
||||
|
||||
/* In theory, it could have been buried before we got back
|
||||
|
||||
Reference in New Issue
Block a user