diff --git a/lib/logstorage/arena.go b/lib/logstorage/arena.go index f6b37375a..e11d2b4dd 100644 --- a/lib/logstorage/arena.go +++ b/lib/logstorage/arena.go @@ -34,6 +34,10 @@ func (a *arena) sizeBytes() int { } func (a *arena) copyBytes(b []byte) []byte { + if len(b) == 0 { + return b + } + ab := a.b abLen := len(ab) ab = append(ab, b...) @@ -53,6 +57,10 @@ func (a *arena) copyString(s string) string { } func (a *arena) newBytes(size int) []byte { + if size <= 0 { + return nil + } + ab := a.b abLen := len(ab) ab = bytesutil.ResizeWithCopyMayOverallocate(ab, abLen+size)