| commit | 977f9ed4b8c652b258f7a2734efaf85c508ce5f5 | [log] [tgz] |
|---|---|---|
| author | Michal Lenc <michallenc@seznam.cz> | Fri Dec 12 16:29:15 2025 +0100 |
| committer | Alan C. Assis <acassis@gmail.com> | Sat Dec 13 18:13:19 2025 -0300 |
| tree | 694c2ea3d7039aaa66385149849df09df4f0fd27 | |
| parent | 67584d99819ebaf0fdab6c658477c22b8363cad8 [diff] |
libs/libc/obstack/lib_obstack_free.c: fix object check within chunk The original condition incorrectly used &h->chunk instead of h->chunk in the calculation whether the object is in the chunk. This could lead to the wrong behavior as the first branch gave incorrect result and thus sometimes the entire obstack was freed even though object was not NULL. The commit also simplifies the logic, we can use pointer arithmetic here and just do h->chunk + 1 as it gives the same result as (FAR char *)h->chunk + sizeof(struct _obstack_chunk). This saves unnecessary cast and sizeof. The second branch should be less than or equal, not just less than. This ensures the object is correctly located in the chunk even after previous obstack_finish was called. Signed-off-by: Michal Lenc <michallenc@seznam.cz> Co-authored-by: Karel Kočí <kkoci@elektroline.cz>
Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).
For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.
First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.
You can find the current NuttX documentation on the Documentation Page.
Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.
The old NuttX documentation is still available in the Apache wiki.
NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.
If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.
The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.