diff --git a/helper/stats/cpu.go b/helper/stats/cpu.go index b3596a428..c9cec2d26 100644 --- a/helper/stats/cpu.go +++ b/helper/stats/cpu.go @@ -37,7 +37,8 @@ func Init() error { } var cpuInfo []cpu.InfoStat - ctx, _ := context.WithTimeout(context.Background(), cpuInfoTimeout) + ctx, cancel := context.WithTimeout(context.Background(), cpuInfoTimeout) + defer cancel() if cpuInfo, err = cpu.InfoWithContext(ctx); err != nil { merrs = multierror.Append(merrs, fmt.Errorf("Unable to obtain CPU information: %v", err)) }