mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-23 00:56:20 +00:00
util/clientmetric: fix regression causing Metric.v to be uninitialised
m.v was uninitialised when Tailscale built with ts_omit_logtail Fixes #17918 Signed-off-by: Avery Palmer <quagsirus@catpowered.net>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
8444659ed8
commit
8aa46a3956
@@ -133,15 +133,18 @@ func (m *Metric) Publish() {
|
|||||||
metrics[m.name] = m
|
metrics[m.name] = m
|
||||||
sortedDirty = true
|
sortedDirty = true
|
||||||
|
|
||||||
|
if m.f == nil {
|
||||||
|
if len(valFreeList) == 0 {
|
||||||
|
valFreeList = make([]int64, 256)
|
||||||
|
}
|
||||||
|
m.v = &valFreeList[0]
|
||||||
|
valFreeList = valFreeList[1:]
|
||||||
|
}
|
||||||
|
|
||||||
if buildfeatures.HasLogTail {
|
if buildfeatures.HasLogTail {
|
||||||
if m.f != nil {
|
if m.f != nil {
|
||||||
lastLogVal = append(lastLogVal, scanEntry{f: m.f})
|
lastLogVal = append(lastLogVal, scanEntry{f: m.f})
|
||||||
} else {
|
} else {
|
||||||
if len(valFreeList) == 0 {
|
|
||||||
valFreeList = make([]int64, 256)
|
|
||||||
}
|
|
||||||
m.v = &valFreeList[0]
|
|
||||||
valFreeList = valFreeList[1:]
|
|
||||||
lastLogVal = append(lastLogVal, scanEntry{v: m.v})
|
lastLogVal = append(lastLogVal, scanEntry{v: m.v})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user