mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-30 23:19:08 +08:00
Merge branch 'bugfix/fix_heap_size_error' into 'master'
Fix heap size error See merge request sdk/ESP8266_RTOS_SDK!514
This commit is contained in:
@ -123,7 +123,7 @@ static inline bool ptr_is_traced(void *ptr)
|
||||
{
|
||||
uint32_t *p = (uint32_t *)ptr - 1;
|
||||
|
||||
return p[0] & 0xf0000000 ? (p[0] == 0xffffffff ? true : false) : true;
|
||||
return p[0] & 0xf0000000 ? false : true;
|
||||
}
|
||||
|
||||
static inline mem_blk_t *ptr2blk(void *ptr, bool trace)
|
||||
|
@ -181,6 +181,7 @@ void *_heap_caps_malloc(size_t size, uint32_t caps, const char *file, size_t lin
|
||||
ESP_EARLY_LOGV(TAG, "free_blk is %p", g_heap_region[num].free_blk);
|
||||
}
|
||||
|
||||
mem_blk_size = blk_link_size(mem_blk);
|
||||
g_heap_region[num].free_bytes -= mem_blk_size;
|
||||
|
||||
if (g_heap_region[num].min_free_bytes > g_heap_region[num].free_bytes)
|
||||
@ -238,12 +239,10 @@ void _heap_caps_free(void *ptr, const char *file, size_t line)
|
||||
}
|
||||
|
||||
mem_blk = ptr2blk(ptr, ptr_is_traced(ptr));
|
||||
#ifdef CONFIG_ESP_HEAP_CHECK_FREED
|
||||
if (mem_blk->prev) {
|
||||
ESP_EARLY_LOGE("%p already freed\n", ptr);
|
||||
if (!mem_blk_is_used(mem_blk)) {
|
||||
ESP_EARLY_LOGE(TAG, "%p already freed\n", ptr);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ESP_EARLY_LOGV(TAG, "Free(ptr=%p, mem_blk=%p, region=%d)", ptr, mem_blk, num);
|
||||
|
||||
|
Reference in New Issue
Block a user