Skip to content

Commit

Permalink
Make sure nothing is nil in tmp slice (#1423)
Browse files Browse the repository at this point in the history
  • Loading branch information
thor-son committed Nov 14, 2022
1 parent f095481 commit c57a2ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion args.go
Expand Up @@ -371,9 +371,10 @@ func visitArgsKey(args []argsKV, f func(k []byte)) {
func copyArgs(dst, src []argsKV) []argsKV {
if cap(dst) < len(src) {
tmp := make([]argsKV, len(src))
dstLen := len(dst)
dst = dst[:cap(dst)] // copy all of dst.
copy(tmp, dst)
for i := len(dst); i < len(tmp); i++ {
for i := dstLen; i < len(tmp); i++ {
// Make sure nothing is nil.
tmp[i].key = []byte{}
tmp[i].value = []byte{}
Expand Down

0 comments on commit c57a2ce

Please sign in to comment.