ARMmbed / core-util

DEPRECATED: Mbed 3 utilities library
Other
12 stars 17 forks source link

Fixed HardFault when memory is full #47

Closed antevir closed 8 years ago

antevir commented 8 years ago

mbed_krbs_ex returned -1 on failed allocation while callers checks for NULL, resulting in corrupt memory and HardFault

Fixes #46

ciarmcom commented 8 years ago

Automatic CI verification build not done, please verify manually.

bogdanm commented 8 years ago

Cc @bremoran

bremoran commented 8 years ago

mbed_krbs and mbed_krbs_ex are intended to have the same semantics as sbrk and mbed_sbrk. As a result, it's intentional that mbed_krbs_ex returns -1.

I believe the fault lies with ualloc, which should translate a -1 from krbs into a NULL.

bremoran commented 8 years ago

I have filed a PR to fix this issue from the ualloc side.

antevir commented 8 years ago

You are right! Better to keep the sbrk semantec.