RTEMS | bsps/shared/gpio: Fix group define leaks (!1281)
Yang Zhang (@Chloe)
gitlab at rtems.org
Wed Jun 3 07:29:06 UTC 2026
Yang Zhang created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1281
Project:Branches: Chloe/rtems:fix-gpio-group-define-cleanup to rtems/rtos/rtems:main
Author: Yang Zhang
## Summary
In rtems_gpio_define_pin_group(), several malloc() calls did not check their return values. This could lead to NULL pointer dereferences in later initialization steps.\
\
The previous error handling also leaked memory and hardware pin resources if an intermediate step, such as pin selection or lock creation, failed during initialization.\
\
This patch refactors the error handling to use a single cleanup path.
## AI Details
I have read the RTEMS Generative AI statement.
### Prompt used
Carefully review the correctness of my modifications in terms of null pointer checks and memory leak prevention.
### AI model used
Claude Sonnet 4.6 and gemini-3.1-pro-preview
### How AI was used for the contribution
- [ ] Review correctness and suggest revision.
### Access
I have not used a product that claims copyright over the generated output, and I have legitimate access to the AI tools used.
<!--Default settings, if it is a dropdown it will set after submission-->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1281
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/20260603/bb03f1aa/attachment.htm>
More information about the bugs
mailing list