diff --git a/src/runtime/slice.go b/src/runtime/slice.go index 8e363e017d..8c1023c1e8 100644 --- a/src/runtime/slice.go +++ b/src/runtime/slice.go @@ -366,6 +366,6 @@ func bytealg_MakeNoZero(len int) []byte { if uintptr(len) > maxAlloc { panicmakeslicelen() } - l := roundupsize(uintptr(len), true) - return unsafe.Slice((*byte)(mallocgc(uintptr(l), nil, false)), l)[:len] + cap := roundupsize(uintptr(len), true) + return unsafe.Slice((*byte)(mallocgc(uintptr(cap), nil, false)), cap)[:len] }