Revert "return buffer to pool before early return"

8d8da386f2

misread this - unsigned will be nil if there's an
error, so it was right the way it was
This commit is contained in:
Yusef Napora 2020-01-17 15:43:33 -05:00
parent 7ee4611788
commit 3c208b0d26

View File

@ -65,10 +65,10 @@ func MakeEnvelope(privateKey crypto.PrivKey, domain string, payloadType []byte,
seq := statelessSeqNo()
unsigned, err := makeUnsigned(domain, payloadType, payload, seq)
defer pool.Put(unsigned)
if err != nil {
return nil, err
}
defer pool.Put(unsigned)
sig, err := privateKey.Sign(unsigned)
if err != nil {
@ -226,10 +226,10 @@ func (e *Envelope) TypedRecord(dest Record) error {
// or an error if signature validation fails.
func (e *Envelope) validate(domain string) error {
unsigned, err := makeUnsigned(domain, e.PayloadType, e.RawPayload, e.Seq)
defer pool.Put(unsigned)
if err != nil {
return err
}
defer pool.Put(unsigned)
valid, err := e.PublicKey.Verify(unsigned, e.signature)
if err != nil {