anchao opened a new pull request, #20860:
URL: https://github.com/apache/nuttx/pull/20860
## Summary
Fix a file reference leak in the `rammap()` failure path.
`rammap()` takes an extra reference on the backing file before adding the
mapping entry to the current memory map. If `mm_map_add()` fails, the
mapping entry is not installed and the code falls through to the allocated
region cleanup path.
The previous failure path freed the allocated mapping region but did not
release the extra file reference.
This change drops the file reference before cleaning up the mapping region
when `mm_map_add()` fails.
## Impact
- Prevents leaking the backing file reference when `mm_map_add()` fails.
- Keeps the successful mapping path unchanged.
- Only affects the error path after `file_ref()` succeeds and
`mm_map_add()` 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]