Skip to content

Commit

Permalink
fix allocation error in high throughput scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
iqbalaydrus committed Jul 10, 2023
1 parent 32a8bee commit fe86fb9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ func Run(c config, r io.Reader, noSnmpTrapD bool) {
metrics.SnmpTrapDDropped.Inc()
continue
}
msg := line[idx+magicBeginLen:]
msg := make([]byte, len(line)-magicBeginLen-idx)
copy(msg, line[idx+magicBeginLen:])
log.Trace().Bytes("data", msg).Msg("sending data")
parseChan <- msg
metrics.SnmpTrapDSucceeded.Inc()
Expand Down

0 comments on commit fe86fb9

Please sign in to comment.