Make sure nothing is nil in tmp slice (#1423)

This commit is contained in:
hs son
2022-11-15 01:15:41 +09:00
committed by GitHub
parent f095481f00
commit c57a2ce871
+2 -1
View File
@@ -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{}