Skip to content

Commit 3cbfbf8

Browse files
committed
fw: prevent overwrite inrecord pit token
1 parent 288df65 commit 3cbfbf8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

fw/table/pit-cs-pool.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ type PitCsPoolsT struct {
1313

1414
var PitCsPools = &PitCsPoolsT{
1515
PitInRecord: sync_pool.New(
16-
func() *PitInRecord {
17-
return &PitInRecord{
18-
PitToken: make([]byte, 0, 8),
19-
}
20-
},
16+
func() *PitInRecord { return &PitInRecord{} },
2117
func(obj *PitInRecord) {
22-
obj.PitToken = obj.PitToken[:0]
18+
// Do not reuse the PitToken array since it is passed
19+
// to the outgoing pipeline without copying.
20+
obj.PitToken = make([]byte, 0, 8)
2321
},
2422
),
2523

0 commit comments

Comments
 (0)