Commit 2638e7b
committed
Fix file descriptor leak in GCP FGetObject on error paths
In FGetObject, objectFile is opened but never closed when
NewReader or io.Copy fails, leaking a file descriptor.
Add defer objectFile.Close() after the successful open to ensure
the file is always closed, regardless of which error path is taken.
The existing explicit Close() on the happy path runs first; the
deferred close is a harmless no-op in that case.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>1 parent 3bd3c0e commit 2638e7b
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| |||
0 commit comments