fix(gin): close os.File in RunFd to prevent resource leak (#4422)

Co-authored-by: 1911860538 <alxps1911@gmail.com>
This commit is contained in:
Name 2025-11-07 12:01:19 +08:00 committed by GitHub
parent acc55e049e
commit c3d5a28ed6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

1
gin.go
View File

@ -593,6 +593,7 @@ func (engine *Engine) RunFd(fd int) (err error) {
}
f := os.NewFile(uintptr(fd), fmt.Sprintf("fd@%d", fd))
defer f.Close()
listener, err := net.FileListener(f)
if err != nil {
return