Skip to content

Commit

Permalink
Merge pull request #7445 from yyforyongyu/fix-heap
Browse files Browse the repository at this point in the history
discovery: fix heap escape on `cachedMsgs`
  • Loading branch information
Roasbeef authored Feb 24, 2023
2 parents cfc19a9 + ce1d1c6 commit 9f1daf3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions discovery/gossiper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1905,9 +1905,10 @@ func (d *AuthenticatedGossiper) isPremature(chanID lnwire.ShortChannelID,
pMsg := &processedNetworkMsg{msg: copied}

// Add the network message.
cachedMsgs.msgs = append(cachedMsgs.msgs, pMsg)
msgs := cachedMsgs.msgs
msgs = append(msgs, pMsg)
_, err = d.futureMsgs.Put(msgHeight, &cachedNetworkMsg{
msgs: cachedMsgs.msgs,
msgs: msgs,
})
if err != nil {
log.Errorf("Adding future message got error: %v", err)
Expand Down

0 comments on commit 9f1daf3

Please sign in to comment.