mdns: check all mallocs for failure and add default hook to log error with free heap

solves crash about _mdns_result_txt_create when stress test


* Original commit: espressif/esp-idf@c8cb4cd3c8
This commit is contained in:
David Cermak
2018-12-07 20:43:13 +01:00
committed by suren-gabrielyan-espressif
parent b4e57424f9
commit 7a4fdad16d
3 changed files with 66 additions and 0 deletions

View File

@ -118,6 +118,9 @@
#define MDNS_SEARCH_LOCK() xSemaphoreTake(_mdns_server->search.lock, portMAX_DELAY)
#define MDNS_SEARCH_UNLOCK() xSemaphoreGive(_mdns_server->search.lock)
#ifndef HOOK_MALLOC_FAILED
#define HOOK_MALLOC_FAILED ESP_LOGE(TAG, "Cannot allocate memory (line: %d, free heap: %d bytes)", __LINE__, esp_get_free_heap_size());
#endif
typedef enum {
PCB_OFF, PCB_DUP, PCB_INIT,