Skip to content

Commit

Permalink
pathbuilder: it's not safe to reuse memory
Browse files Browse the repository at this point in the history
Signed-off-by: Vicent Marti <vmg@strn.cat>
  • Loading branch information
vmg committed Feb 11, 2025
1 parent 072f3e3 commit 474d9fb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions go/vt/sqlparser/pathbuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package pathbuilder

import (
"encoding/binary"
"unsafe"
)

// ASTPathBuilder is used to build
Expand All @@ -39,7 +38,7 @@ func NewASTPathBuilder() *ASTPathBuilder {

// ToPath returns the current path as a string of the used bytes.
func (apb *ASTPathBuilder) ToPath() string {
return unsafe.String(unsafe.SliceData(apb.path), len(apb.path))
return string(apb.path)
}

// AddStep appends a single step (2 bytes) to path.
Expand Down

0 comments on commit 474d9fb

Please sign in to comment.