fix(gin): close os.File in RunFd to prevent resource leak#4422
fix(gin): close os.File in RunFd to prevent resource leak#4422appleboy merged 1 commit intogin-gonic:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4422 +/- ##
==========================================
- Coverage 99.21% 98.96% -0.25%
==========================================
Files 42 44 +2
Lines 3182 2900 -282
==========================================
- Hits 3157 2870 -287
- Misses 17 19 +2
- Partials 8 11 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Verified safe since net.FileListener internally duplicates the Therefore, defer f.Close() does not interfere with existing connections |
os.NewFilecreates a*os.Fileobject that holds a reference tothe file descriptor. Even though the file descriptor itself is
not opened by
os.NewFile, the*os.Fileobject needs to be cleanedup to release its reference.