From 9dd9c7602728df6cfebe04115b40d9e01a428e45 Mon Sep 17 00:00:00 2001 From: Tay Date: Sat, 21 Mar 2026 13:17:12 -0700 Subject: [PATCH] commands: Close cpu profile file when StartCPUProfile fails --- commands/hugobuilder.go | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/hugobuilder.go b/commands/hugobuilder.go index 559a79362..4037f6611 100644 --- a/commands/hugobuilder.go +++ b/commands/hugobuilder.go @@ -179,6 +179,7 @@ func (c *hugoBuilder) initCPUProfile() (func(), error) { return nil, fmt.Errorf("failed to create CPU profile: %w", err) } if err := pprof.StartCPUProfile(f); err != nil { + f.Close() return nil, fmt.Errorf("failed to start CPU profile: %w", err) } return func() { -- 2.39.5