mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 10:17:30 +02:00
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:
committed by
suren-gabrielyan-espressif
parent
b4e57424f9
commit
7a4fdad16d
@ -5,6 +5,7 @@
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "mdns_networking.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
|
||||
extern mdns_server_t * _mdns_server;
|
||||
@ -13,6 +14,7 @@ extern mdns_server_t * _mdns_server;
|
||||
* MDNS Server Networking
|
||||
*
|
||||
*/
|
||||
static const char *TAG = "MDNS_Networking";
|
||||
|
||||
static struct udp_pcb * _pcb_main = NULL;
|
||||
|
||||
@ -118,6 +120,7 @@ static void _udp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *pb, const ip
|
||||
|
||||
mdns_rx_packet_t * packet = (mdns_rx_packet_t *)malloc(sizeof(mdns_rx_packet_t));
|
||||
if (!packet) {
|
||||
HOOK_MALLOC_FAILED;
|
||||
//missed packet - no memory
|
||||
pbuf_free(this_pb);
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user