1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 18:17:52 -05:00

allow buffer on local stack

This commit is contained in:
v2ray 2016-07-16 13:22:08 +02:00
parent 8d3da0ed8e
commit f45fa6e918
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -35,7 +35,9 @@ func (b *Buffer) Release() {
if b == nil || b.head == nil {
return
}
b.pool.Free(b)
if b.pool != nil {
b.pool.Free(b)
}
b.head = nil
b.Value = nil
b.pool = nil
@ -216,3 +218,7 @@ func NewBufferWithSize(size int) *Buffer {
return NewLargeBuffer()
}
func NewLocalBuffer(size int) *Buffer {
return CreateBuffer(make([]byte, size), nil)
}