]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
commands: Close cpu profile file when StartCPUProfile fails
authorTay <buley@outlook.com>
Sat, 21 Mar 2026 20:17:12 +0000 (13:17 -0700)
committerGitHub <noreply@github.com>
Sat, 21 Mar 2026 20:17:12 +0000 (21:17 +0100)
commands/hugobuilder.go

index 559a79362be165b8af7a7ab8a4bb488fd36dd830..4037f66117d836add66053503df18a6aee3f2a5e 100644 (file)
@@ -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() {