mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
Recycle memory earlier in error case
This commit is contained in:
parent
8334d5177e
commit
fe7d2d8984
@ -11,6 +11,9 @@ const (
|
||||
func ReadFrom(reader io.Reader) ([]byte, error) {
|
||||
buffer := make([]byte, bufferSize)
|
||||
nBytes, err := reader.Read(buffer)
|
||||
if nBytes == 0 {
|
||||
buffer = nil
|
||||
}
|
||||
return buffer[:nBytes], err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user