mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-24 23:55:18 +00:00
fix: race condition on memory clearing
This commit is contained in:
parent
2525c4ce7e
commit
05acdbf56f
@ -422,13 +422,16 @@ func (p *PebbleClockStore) GetMasterClockFrame(
|
||||
return nil, errors.Wrap(err, "get master clock frame")
|
||||
}
|
||||
|
||||
copied := make([]byte, len(value))
|
||||
copy(copied[:], value[:])
|
||||
|
||||
defer closer.Close()
|
||||
frame := &protobufs.ClockFrame{}
|
||||
frame.FrameNumber = frameNumber
|
||||
frame.Filter = filter
|
||||
frame.Difficulty = binary.BigEndian.Uint32(value[:4])
|
||||
frame.Input = value[4 : len(value)-516]
|
||||
frame.Output = value[len(value)-516:]
|
||||
frame.Difficulty = binary.BigEndian.Uint32(copied[:4])
|
||||
frame.Input = copied[4 : len(copied)-516]
|
||||
frame.Output = copied[len(copied)-516:]
|
||||
|
||||
previousSelectorBytes := [516]byte{}
|
||||
copy(previousSelectorBytes[:], frame.Input[:516])
|
||||
|
Loading…
Reference in New Issue
Block a user