1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 15:46:14 +01:00

mDNS malloc error fix

This commit is contained in:
Harald Barth 2024-11-16 20:50:25 +01:00
parent 1235c288dc
commit 9602c32ea7
2 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,7 @@ int MDNS::begin(const IPAddress& ip, char* name) {
// delay(100); // delay(100);
_ipAddress = ip; _ipAddress = ip;
_name = (char *)malloc(strlen(name +2)); _name = (char *)malloc(strlen(name)+2);
byte n; byte n;
for(n = 0; n<strlen(name); n++) for(n = 0; n<strlen(name); n++)
_name[n+1] = name[n]; _name[n+1] = name[n];
@ -87,7 +87,7 @@ int MDNS::begin(const IPAddress& ip, char* name) {
int MDNS::addServiceRecord(const char* name, uint16_t port, MDNSServiceProtocol_t proto) { int MDNS::addServiceRecord(const char* name, uint16_t port, MDNSServiceProtocol_t proto) {
// we ignore proto, assume TCP // we ignore proto, assume TCP
_serviceName = (char *)malloc(strlen(name +2)); _serviceName = (char *)malloc(strlen(name)+2);
byte n; byte n;
for(n = 0; n<strlen(name); n++) for(n = 0; n<strlen(name); n++)
_serviceName[n+1] = name[n]; _serviceName[n+1] = name[n];

View File

@ -39,9 +39,9 @@
//#define LWIP_DEBUG 1 //#define LWIP_DEBUG 1
//#define TCP_DEBUG LWIP_DBG_ON //#define TCP_DEBUG LWIP_DBG_ON
// IMPORTANT CHANGE THE FIRST ONE // NOT STRICT NECESSARY ANY MORE BUT CAN BE USED TO SAVE RAM
#undef MEM_LIBC_MALLOC #undef MEM_LIBC_MALLOC
#define MEM_LIBC_MALLOC 1 // critical, fixes heap trashing #define MEM_LIBC_MALLOC 1 // use the same malloc as for everything else
#undef MEMP_MEM_MALLOC #undef MEMP_MEM_MALLOC
#define MEMP_MEM_MALLOC 1 // uses malloc which means no pools which means slower but not mean 32KB up front #define MEMP_MEM_MALLOC 1 // uses malloc which means no pools which means slower but not mean 32KB up front