Commit e22db73
committed
fix: close CPU profile file immediately on StartCPUProfile error
When pprof.StartCPUProfile fails, the file was left to be closed by
a deferred call placed before the error check. This could shadow the
original error and delay resource cleanup. Now the file is closed
explicitly on error, and defer is placed after the success path.
Fixes #1770
Fixes #1765
Assisted-By: cagent1 parent 428cee5 commit e22db73
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | 145 | | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
0 commit comments