release buffer on error

pull/298/merge
Darien Raymond 2017-04-27 11:29:44 +02:00
parent 326a54baea
commit 999717ee28
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 1 additions and 0 deletions

View File

@ -59,6 +59,7 @@ func (*HeaderReader) Read(reader io.Reader) (*buf.Buffer, error) {
for totalBytes < maxHeaderLength {
err := buffer.AppendSupplier(buf.ReadFrom(reader))
if err != nil {
buffer.Release()
return nil, err
}
if n := bytes.Index(buffer.Bytes(), []byte(ENDING)); n != -1 {