release buffer after using

pull/40/head
V2Ray 2015-10-10 17:01:05 +02:00
parent bcffdf0da5
commit 578ede2538
1 changed files with 2 additions and 0 deletions

View File

@ -137,6 +137,7 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W
responseBuffer := alloc.NewSmallBuffer().Clear()
response.Write(responseBuffer)
_, err = writer.Write(responseBuffer.Value)
responseBuffer.Release()
if err != nil {
log.Error("Socks failed to write response: %v", err)
return err
@ -158,6 +159,7 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W
responseBuffer := alloc.NewSmallBuffer().Clear()
response.Write(responseBuffer)
_, err = writer.Write(responseBuffer.Value)
responseBuffer.Release()
if err != nil {
log.Error("Socks failed to write response: %v", err)
return err