mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 18:17:52 -05:00
release buffer on error
This commit is contained in:
parent
326a54baea
commit
999717ee28
@ -59,6 +59,7 @@ func (*HeaderReader) Read(reader io.Reader) (*buf.Buffer, error) {
|
|||||||
for totalBytes < maxHeaderLength {
|
for totalBytes < maxHeaderLength {
|
||||||
err := buffer.AppendSupplier(buf.ReadFrom(reader))
|
err := buffer.AppendSupplier(buf.ReadFrom(reader))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
buffer.Release()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if n := bytes.Index(buffer.Bytes(), []byte(ENDING)); n != -1 {
|
if n := bytes.Index(buffer.Bytes(), []byte(ENDING)); n != -1 {
|
||||||
|
Loading…
Reference in New Issue
Block a user