Allocate just enough space

Remove the len()*2, and replace it with len()+1. The current
len() impl. of the types is good enough to be more precise.
This commit is contained in:
Miek Gieben 2013-12-06 11:30:33 +00:00
parent 70ee966106
commit 6b32a711e9
2 changed files with 2 additions and 2 deletions

View File

@ -685,7 +685,7 @@ func rawSignatureData(rrset []RR, s *RRSIG) (buf []byte, err error) {
x.Target = strings.ToLower(x.Target)
}
// 6.2. Canonical RR Form. (5) - origTTL
wire := make([]byte, r1.len()*2) // TODO(mg): *2 ?
wire := make([]byte, r1.len()+1) // +1 to be safe(r)
off, err1 := PackRR(r1, wire, 0, nil, false)
if err1 != nil {
return nil, err1

View File

@ -1181,7 +1181,7 @@ func (rr *TKEY) len() int {
len(rr.Key) + 2 + len(rr.OtherData)
}
// RFC3597 representes an unknown/generic RR.
// RFC3597 represents an unknown/generic RR.
type RFC3597 struct {
Hdr RR_Header
Rdata string `dns:"hex"`