Fix: decrease packet reference (#106)

ref: https://github.com/google/gvisor/commit/f375784d83852b1e3ff20cc9de0648b3c0cf8525
This commit is contained in:
xjasonlyu
2022-03-29 13:39:18 +08:00
parent c2af4c0c7c
commit 0e8b16f9a1
+3 -1
View File
@@ -103,7 +103,7 @@ func (e *Endpoint) dispatchLoop(cancel context.CancelFunc) {
case header.IPv6Version:
e.InjectInbound(header.IPv6ProtocolNumber, pkt)
}
pkt.DecRef() /* release */
pkt.DecRef()
}
}
@@ -121,6 +121,8 @@ func (e *Endpoint) outboundLoop(ctx context.Context) {
// writePacket writes outbound packets to the io.Writer.
func (e *Endpoint) writePacket(pkt *stack.PacketBuffer) tcpip.Error {
defer pkt.DecRef()
size := pkt.Size()
views := pkt.Views()
if e.offset != 0 {