1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

release buffer on error

This commit is contained in:
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

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 {