lib/storage: properly set buf capacity inside marshalMetricID

Previously it was always set to 0. In theory this could result into incorrect marshaling
of metricIDs.

The issue has been introduced in 5e4dfe50c6
This commit is contained in:
Aliaksandr Valialkin 2022-12-19 10:14:34 -08:00
parent 4cb83f0f4a
commit 057fb2120b
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -443,8 +443,8 @@ func marshalMetricIDs(dst []byte, metricIDs []uint64) []byte {
var buf []byte
sh := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
sh.Data = uintptr(unsafe.Pointer(&metricIDs[0]))
sh.Cap = sh.Len
sh.Len = 8 * len(metricIDs)
sh.Cap = 8 * len(metricIDs)
sh.Len = sh.Cap
dst = append(dst, buf...)
return dst
}