Skip to content

Commit e77d58c

Browse files
fix: address memory
1 parent 72b8264 commit e77d58c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/pam/handlers/ssh/sftp_parser.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ func (p *SFTPParser) Parse(data []byte) []SFTPOperation {
6565
}
6666
}
6767

68+
// Compact buffer to release consumed memory
69+
// Without this, the backing array grows indefinitely during long sessions
70+
if len(p.buffer) > 0 {
71+
p.buffer = append([]byte(nil), p.buffer...)
72+
} else {
73+
p.buffer = p.buffer[:0]
74+
}
75+
6876
return operations
6977
}
7078

0 commit comments

Comments
 (0)