mirror of
https://github.com/gin-gonic/gin.git
synced 2025-12-13 13:12:17 +08:00
fix: close os.File in RunFd to prevent resource leak
This commit is contained in:
parent
5e5ff3ace4
commit
f600b0adb1
1
gin.go
1
gin.go
@ -593,6 +593,7 @@ func (engine *Engine) RunFd(fd int) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
f := os.NewFile(uintptr(fd), fmt.Sprintf("fd@%d", fd))
|
f := os.NewFile(uintptr(fd), fmt.Sprintf("fd@%d", fd))
|
||||||
|
defer f.Close()
|
||||||
listener, err := net.FileListener(f)
|
listener, err := net.FileListener(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user