Browse Source

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>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
ee939c8dcb
  1. 11
      lightningd/peer_control.c

11
lightningd/peer_control.c

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

Loading…
Cancel
Save