Skip to content

Commit

Permalink
A temporary testing fix for the buffer corruption issue (#3331)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokangwang authored Feb 27, 2025
1 parent 4144c87 commit 561f312
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/dispatcher/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin

func sniffer(ctx context.Context, cReader *cachedReader, metadataOnly bool, network net.Network) (SniffResult, error) {
payload := buf.New()
defer payload.Release()

defer func() {
payload.Release()
}()

sniffer := NewSniffer(ctx)

Expand Down
4 changes: 3 additions & 1 deletion common/protocol/quic/sniff.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
// Crypto data separated across packets
cryptoLen := 0
cryptoData := bytespool.Alloc(int32(len(b)))
defer bytespool.Free(cryptoData)
defer func() {
bytespool.Free(cryptoData)
}()

cache := buf.New()
defer cache.Release()
Expand Down

0 comments on commit 561f312

Please sign in to comment.