Skip to content

Commit

Permalink
Merge pull request buger#241 from unxcepted/master
Browse files Browse the repository at this point in the history
fix EachKey pIdxFlags allocation
  • Loading branch information
buger authored Apr 18, 2022
2 parents 2181e83 + 6fc2e48 commit 61b32cf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,12 @@ func EachKey(data []byte, cb func(int, []byte, ValueType, error), paths ...[]str
case '[':
var ok bool
arrIdxFlags := make(map[int]struct{})
pIdxFlags := make([]bool, len(paths))

pIdxFlags := make([]bool, stackArraySize)[:]
if len(paths) > cap(pIdxFlags) {
pIdxFlags = make([]bool, len(paths))[:]
}
pIdxFlags = pIdxFlags[0:len(paths)]

if level < 0 {
cb(-1, nil, Unknown, MalformedJsonError)
Expand Down

0 comments on commit 61b32cf

Please sign in to comment.