RTEMS | libmisc/regulator: Fix assertion failures and resource leaks on error paths (!1479)
Sharvin Neve (@Sharvin)
gitlab at rtems.org
Tue Sep 8 18:26:23 UTC 2026
Sharvin Neve created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1479
Project:Branches: Sharvin/rtems:fix-regulator-error-assertions to rtems/rtos/rtems:main
Author: Sharvin Neve
Closes #5747.
- In `_Regulator_Output_task_body()`: `rtems_message_queue_receive()` returns
`RTEMS_UNSATISFIED` when the queue contains fewer messages than
`maximum_to_dequeue_per_period`. That is the expected condition ending the
dequeue loop for that period; asserting strictly `RTEMS_SUCCESSFUL` causes an
assertion failure on every empty or partially-filled period under `RTEMS_DEBUG`.
Update the assertion to accept both `RTEMS_SUCCESSFUL` and `RTEMS_UNSATISFIED`.
- In `_Regulator_Free_helper()`:
- Guard task deletion so `rtems_task_delete()` is not invoked on an already
exited delivery task (`delivery_thread_has_exited == true`) or an invalid task ID.
- In `rtems_regulator_create()`, if `rtems_message_queue_construct()` fails,
`message_queue_storage` was allocated via `malloc()` while `queue_id` is 0.
Directly free `message_queue_storage` in `_Regulator_Free_helper()` if `queue_id == 0`.
- Guard `messages_partition_id` deletion against 0 and explicitly free `message_memory`.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1479
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/5-258ov4rjqt447ru90rsmdbcjk-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260908/c4dc89a4/attachment-0001.htm>
More information about the bugs
mailing list