Skip to content

Commit

Permalink
Actually clone to not be affected by other calls
Browse files Browse the repository at this point in the history
Signed-off-by: Dirkjan Bussink <[email protected]>
  • Loading branch information
dbussink committed Dec 12, 2024
1 parent e4140e6 commit bf51e68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go/vt/logutil/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io"
"runtime"
"slices"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -249,7 +250,7 @@ func (ml *MemoryLogger) Clear() {
func (ml *MemoryLogger) LogEvents() []*logutilpb.Event {
ml.mu.Lock()
defer ml.mu.Unlock()
return ml.Events
return slices.Clone(ml.Events)
}

// LoggerWriter is an adapter that implements the io.Writer interface.
Expand Down

0 comments on commit bf51e68

Please sign in to comment.