anchao opened a new pull request, #20857:
URL: https://github.com/apache/nuttx/pull/20857
## Summary
Fix a host file descriptor leak in `hostfs_open()`.
`hostfs_open()` opens the host file first, then seeks to the end when the
file is opened with `O_APPEND`. If that append seek failed, the previous
error path freed the hostfs file structure but did not close the host file
descriptor that had already been opened.
This change routes the append seek failure through a cleanup path that
closes the host file descriptor before freeing the hostfs file structure.
## Impact
- Prevents leaking the host file descriptor when `O_APPEND` setup fails.
- Keeps the successful open path unchanged.
- Only affects the error path after `host_open()` succeeds and
`host_lseek(..., SEEK_END)` fails.
## Testing
sim/nsh2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]