Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXED "heap != NULL && "free() target pointer is outside heap areas" on BLERemoteCharacteristic::readValue() #2800

Merged
merged 1 commit into from
Jun 5, 2019

Conversation

elettro1
Copy link
Contributor

When calling the function BLERemoteCharacteristic::readValue() sometimes it gave this error:

[D][FreeRTOS.cpp:158] take(): Semaphore taking: name: ReadCharEvt (0x3fff8f00), owner: <N/A> for readValue
[D][FreeRTOS.cpp:167] take(): Semaphore taken: name: ReadCharEvt (0x3fff8f00), owner: readValue
[D][BLEDevice.cpp:154] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
[D][BLEClient.cpp:158] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
assertion "heap != NULL && "free() target pointer is outside heap areas"" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/heap_caps.c", line 267, function: heap_caps_free
abort() was called at PC 0x4016a1cf on core 0

Backtrace: 0x40093d80:0x3ffe2310 0x40093fb1:0x3ffe2330 0x4016a1cf:0x3ffe2350 0x40086903:0x3ffe2380 0x4008c985:0x3ffe23a0 0x4000bec7:0x3ffe23c0 0x400e4036:0x3ffe23e0 0x400e4981:0x3ffe2420 0x400e30c5:0x3ffe2440 0x400e3bfd:0x3ffe24f0 0x40100179:0x3ffe2560 0x400fc13e:0x3ffe25b0 0x4008f9e5:0x3ffe25e0

This error is generated on free on row 185
if(m_rawData != nullptr) free(m_rawData);

Prevents the error that is generated on free on row 186
When calling the function readValue() sometimes it gave an error on this free.
@elettro1
Copy link
Contributor Author

I saw now that the problem has been fixed in the reposity

https://github.com/nkolban/esp32-snippets/blob/91e1571dd5bd433e107f92e1588780ee22fed42e/cpp_utils/BLERemoteCharacteristic.h#L77
The solution is the same, to be included in the header or in the constructor
m_rawData = nullptr;

But if you don't update the fixes, those who use platformio still have these issues.

@me-no-dev
Copy link
Member

We no longer track nkolban's esp32-snippets repo. Reason is that there is nobody there that is willing to push the updates to the Arduino lib. Merging here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants