Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9dd9c76

Browse files
authored
commands: Close cpu profile file when StartCPUProfile fails
1 parent a8fca59 commit 9dd9c76

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

commands/hugobuilder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ func (c *hugoBuilder) initCPUProfile() (func(), error) {
179179
return nil, fmt.Errorf("failed to create CPU profile: %w", err)
180180
}
181181
if err := pprof.StartCPUProfile(f); err != nil {
182+
f.Close()
182183
return nil, fmt.Errorf("failed to start CPU profile: %w", err)
183184
}
184185
return func() {

0 commit comments

Comments
 (0)