diff --git a/args.go b/args.go index 92e5d5aadc..c8fdccdda3 100644 --- a/args.go +++ b/args.go @@ -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{}