mirror of
https://github.com/fosrl/gerbil.git
synced 2026-02-07 21:46:40 +00:00
Merge pull request #38 from LaurenceJJones/fix/relay-buffer-leak
fix: relay buffer leak on UDP read error
This commit is contained in:
@@ -187,6 +187,8 @@ func (s *UDPProxyServer) readPackets() {
|
||||
n, remoteAddr, err := s.conn.ReadFromUDP(buf)
|
||||
if err != nil {
|
||||
logger.Error("Error reading UDP packet: %v", err)
|
||||
// Return buffer to pool on read error to avoid leaks
|
||||
bufferPool.Put(buf[:1500])
|
||||
continue
|
||||
}
|
||||
s.packetChan <- Packet{data: buf[:n], remoteAddr: remoteAddr, n: n}
|
||||
|
||||
Reference in New Issue
Block a user