Commit 8f154c6
committed
object_db: prevent FD leaks when writing blobs
When writing a blob, there are two places where we use temporary files.
First, we use them when we write the blob itself. Second, we use them
when we encode the buffer. In both of these cases, however, we failed to
close the file after we were done with it, leading to file descriptor
leaks until Go garbage-collected the items.
Add a helper function to close and remove these files and use it in each
of these places. Place the os.Remove statement after the Close
statement, since Windows will be happier if we don't try to remove a
file we have open.1 parent 1d0a28b commit 8f154c6
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
0 commit comments