RTEMS | cpukit/libblock: Fix resource leak in rtems_fdisk_initialize (CID 1439298) (!903)
MITHILESH MATTAPALLI (@mithileshm)
gitlab at rtems.org
Mon Jan 12 08:35:40 UTC 2026
MITHILESH MATTAPALLI created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/903
Project:Branches: mithileshm/rtems:fix-flashdisk-leak to rtems/rtos/rtems:main
Author: MITHILESH MATTAPALLI
Coverity Scan reported a resource leak in `rtems_fdisk_initialize`.
The function allocates memory for the `fd` array but iterates the pointer `fd` during initialization. If subsequent allocations (like `copy_buffer` or `blocks`) fail, the function returns without freeing the original allocated memory.
This patch saves the base pointer `fds` at the start and ensures it is freed in all error handling paths.
Closes CID 1439298.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/903
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260112/c54947ca/attachment.htm>
More information about the bugs
mailing list