lancaster-university / microbit-dal

http://lancaster-university.github.io/microbit-docs
Other
258 stars 131 forks source link

linked code using realloc() will crashes on free() #343

Closed thinkberg closed 6 years ago

thinkberg commented 6 years ago

I am using msgpack-c, which uses realloc() to increase the sbuffer for messages. However, it seems to allocate memory somewhere not directly under control of the dal. When freeing, the native_free() then just crashes. Possibly because the native area is not large enough.

It would probably be wise, to also wrap realloc() in HeapAllocator?

My current fix is to malloc the data ptr that is later realloced beforehand.

finneyj commented 6 years ago

Hi @thinkberg

Thanks for reporting, and apologies for the delay.

Resolved in https://github.com/lancaster-university/microbit-dal/commit/0c746140a3506c2a1991b4789cb0edbcb19cd97d

Will be live in master for v2.1.0