From 692598228412bfbb4561805b88b4370f19f2ef91 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Mon, 17 Aug 2020 18:15:45 +0200 Subject: [PATCH 1/8] replace `new` by `new (std::nothrow)`, remove `arduino_new` --- cores/esp8266/Esp.cpp | 6 +-- cores/esp8266/FunctionalInterrupt.cpp | 38 ++++++++++++++----- cores/esp8266/Print.cpp | 4 +- cores/esp8266/Updater.cpp | 2 +- cores/esp8266/cbuf.cpp | 2 +- cores/esp8266/core_esp8266_features.h | 29 -------------- doc/reference.rst | 33 ---------------- libraries/ArduinoOTA/ArduinoOTA.cpp | 9 +++-- libraries/DNSServer/src/DNSServer.cpp | 3 +- libraries/EEPROM/EEPROM.cpp | 7 +++- .../BasicHttpsClient/BasicHttpsClient.ino | 5 ++- .../StreamHttpsClient/StreamHttpsClient.ino | 5 ++- .../src/ESP8266HTTPClient.cpp | 21 +++++----- .../SecureBearSSLUpdater.ino | 2 +- libraries/ESP8266LLMNR/ESP8266LLMNR.cpp | 4 +- libraries/ESP8266SSDP/ESP8266SSDP.cpp | 9 ++++- .../HelloServerBearSSL/HelloServerBearSSL.ino | 2 +- .../HttpHashCredAuth/HttpHashCredAuth.ino | 2 +- .../src/ESP8266WebServer-impl.h | 12 +++--- libraries/ESP8266WebServer/src/Parsing-impl.h | 20 ++++++++-- libraries/ESP8266WebServer/src/Uri.h | 2 +- .../ESP8266WebServer/src/uri/UriBraces.h | 2 +- libraries/ESP8266WebServer/src/uri/UriGlob.h | 2 +- libraries/ESP8266WebServer/src/uri/UriRegex.h | 2 +- .../BearSSL_CertStore/BearSSL_CertStore.ino | 4 +- .../BearSSL_Server/BearSSL_Server.ino | 4 +- .../BearSSL_ServerClientCert.ino | 6 +-- .../WiFiTelnetToSerial/WiFiTelnetToSerial.ino | 2 +- libraries/ESP8266WiFi/src/BearSSLHelpers.cpp | 8 ++-- .../ESP8266WiFi/src/CertStoreBearSSL.cpp | 10 +++-- libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp | 5 ++- libraries/ESP8266WiFi/src/WiFiClient.cpp | 5 ++- .../src/WiFiClientSecureBearSSL.cpp | 22 +++++------ libraries/ESP8266WiFi/src/WiFiServer.cpp | 5 ++- .../src/WiFiServerSecureBearSSL.cpp | 4 +- libraries/ESP8266WiFi/src/WiFiUdp.cpp | 20 ++++++++-- .../ESP8266WiFi/src/include/ClientContext.h | 6 +-- .../ESP8266WiFi/src/include/DataSource.h | 2 +- .../httpUpdateSigned/httpUpdateSigned.ino | 6 +-- .../ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp | 12 +++++- libraries/LittleFS/src/LittleFS.cpp | 2 +- libraries/LittleFS/src/LittleFS.h | 19 ++++++++-- libraries/SDFS/src/SDFS.cpp | 2 +- .../examples/ConfigFile/ConfigFile.ino | 5 ++- .../examples/SerialStress/SerialStress.ino | 2 +- 45 files changed, 207 insertions(+), 167 deletions(-) diff --git a/cores/esp8266/Esp.cpp b/cores/esp8266/Esp.cpp index 80d969e40c..1b4d3ee431 100644 --- a/cores/esp8266/Esp.cpp +++ b/cores/esp8266/Esp.cpp @@ -740,17 +740,17 @@ String EspClass::getSketchMD5() } uint32_t lengthLeft = getSketchSize(); const size_t bufSize = 512; - std::unique_ptr buf(new uint8_t[bufSize]); + std::unique_ptr buf(new (std::nothrow) uint8_t[bufSize]); uint32_t offset = 0; if(!buf.get()) { - return String(); + return emptyString; } MD5Builder md5; md5.begin(); while( lengthLeft > 0) { size_t readBytes = (lengthLeft < bufSize) ? lengthLeft : bufSize; if (!flashRead(offset, reinterpret_cast(buf.get()), (readBytes + 3) & ~3)) { - return String(); + return emptyString; } md5.add(buf.get(), readBytes); lengthLeft -= readBytes; diff --git a/cores/esp8266/FunctionalInterrupt.cpp b/cores/esp8266/FunctionalInterrupt.cpp index 665d8043b3..f35b315e98 100644 --- a/cores/esp8266/FunctionalInterrupt.cpp +++ b/cores/esp8266/FunctionalInterrupt.cpp @@ -7,7 +7,7 @@ typedef void (*voidFuncPtr)(void); typedef void (*voidFuncPtrArg)(void*); // Helper functions for Functional interrupt routines -extern "C" void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtr userFunc, void*fp, int mode, bool functional); +extern "C" bool __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtr userFunc, void*fp, int mode, bool functional); void ICACHE_RAM_ATTR interruptFunctional(void* arg) @@ -34,32 +34,52 @@ extern "C" } } -void attachInterrupt(uint8_t pin, std::function intRoutine, int mode) +bool attachInterrupt(uint8_t pin, std::function intRoutine, int mode) { // use the local interrupt routine which takes the ArgStructure as argument InterruptInfo* ii = nullptr; - FunctionInfo* fi = new FunctionInfo; + FunctionInfo* fi = new (std::nothrow) FunctionInfo; + if (fi == nullptr) + return false; fi->reqFunction = intRoutine; - ArgStructure* as = new ArgStructure; + ArgStructure* as = new (std::nothrow) ArgStructure; + if (as == nullptr) + { + delete(fi); + return false; + } as->interruptInfo = ii; as->functionInfo = fi; - __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); + return __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); } -void attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode) +bool attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode) { - InterruptInfo* ii = new InterruptInfo; + InterruptInfo* ii = new (std::nothrow) InterruptInfo; + if (ii == nullptr) + return false; FunctionInfo* fi = new FunctionInfo; + if (fi == nullptr) + { + delete ii; + return false; + } fi->reqScheduledFunction = scheduledIntRoutine; - ArgStructure* as = new ArgStructure; + ArgStructure* as = new (std::nothrow) ArgStructure; + if (as == nullptr) + { + delete ii; + delete fi; + return false; + } as->interruptInfo = ii; as->functionInfo = fi; - __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); + return __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); } diff --git a/cores/esp8266/Print.cpp b/cores/esp8266/Print.cpp index d93293ee8a..b0e2e31a14 100644 --- a/cores/esp8266/Print.cpp +++ b/cores/esp8266/Print.cpp @@ -63,7 +63,7 @@ size_t Print::printf(const char *format, ...) { size_t len = vsnprintf(temp, sizeof(temp), format, arg); va_end(arg); if (len > sizeof(temp) - 1) { - buffer = new char[len + 1]; + buffer = new (std::nothrow) char[len + 1]; if (!buffer) { return 0; } @@ -86,7 +86,7 @@ size_t Print::printf_P(PGM_P format, ...) { size_t len = vsnprintf_P(temp, sizeof(temp), format, arg); va_end(arg); if (len > sizeof(temp) - 1) { - buffer = new char[len + 1]; + buffer = new (std::nothrow) char[len + 1]; if (!buffer) { return 0; } diff --git a/cores/esp8266/Updater.cpp b/cores/esp8266/Updater.cpp index 03bc5c3f8f..472a1417a0 100644 --- a/cores/esp8266/Updater.cpp +++ b/cores/esp8266/Updater.cpp @@ -180,7 +180,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) { } else { _bufferSize = 256; } - _buffer = new uint8_t[_bufferSize]; + _buffer = new (std::nothrow) uint8_t[_bufferSize]; _command = command; #ifdef DEBUG_UPDATER diff --git a/cores/esp8266/cbuf.cpp b/cores/esp8266/cbuf.cpp index e655ca6fc6..5f394f9dfc 100644 --- a/cores/esp8266/cbuf.cpp +++ b/cores/esp8266/cbuf.cpp @@ -43,7 +43,7 @@ size_t cbuf::resize(size_t newSize) { return _size; } - char *newbuf = new char[newSize]; + char *newbuf = new (std::nothrow) char[newSize]; char *oldbuf = _buf; if(!newbuf) { diff --git a/cores/esp8266/core_esp8266_features.h b/cores/esp8266/core_esp8266_features.h index 6d6edf0303..cc4cd39777 100644 --- a/cores/esp8266/core_esp8266_features.h +++ b/cores/esp8266/core_esp8266_features.h @@ -36,35 +36,6 @@ #include // size_t #include -#ifdef __cplusplus - -namespace arduino -{ - extern "C++" - template - T* new0 (size_t n, TConstructorArgs... TconstructorArgs) - { - // n==0: single allocation, otherwise it is an array - size_t offset = n? sizeof(size_t): 0; - size_t arraysize = n? n: 1; - T* ptr = (T*)malloc(offset + (arraysize * sizeof(T))); - if (ptr) - { - if (n) - *(size_t*)(ptr) = n; - for (size_t i = 0; i < arraysize; i++) - new (ptr + offset + i * sizeof(T)) T(TconstructorArgs...); - return ptr + offset; - } - return nullptr; - } -} - -#define arduino_new(Type, ...) arduino::new0(0, ##__VA_ARGS__) -#define arduino_newarray(Type, n, ...) arduino::new0(n, ##__VA_ARGS__) - -#endif // __cplusplus - #ifndef __STRINGIFY #define __STRINGIFY(a) #a #endif diff --git a/doc/reference.rst b/doc/reference.rst index 9551d9d035..2ae8ca5cd8 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -323,36 +323,3 @@ C++ This assures correct behavior, including handling of all subobjects, which guarantees stability. History: `#6269 `__ `#6309 `__ `#6312 `__ - -- New optional allocator ``arduino_new`` - - A new optional global allocator is introduced with a different semantic: - - - never throws exceptions on oom - - - never calls constructors on oom - - - returns nullptr on oom - - It is similar to arduino ``new`` semantic without side effects - (except when parent constructors, or member constructors use ``new``). - - Syntax is slightly different, the following shows the different usages: - - .. code:: cpp - - // with new: - - SomeClass* sc = new SomeClass(arg1, arg2, ...); - delete sc; - - SomeClass* scs = new SomeClass[42]; - delete [] scs; - - // with arduino_new: - - SomeClass* sc = arduino_new(SomeClass, arg1, arg2, ...); - delete sc; - - SomeClass* scs = arduino_newarray(SomeClass, 42); - delete [] scs; diff --git a/libraries/ArduinoOTA/ArduinoOTA.cpp b/libraries/ArduinoOTA/ArduinoOTA.cpp index 64e8397a2a..2a7bd235f6 100644 --- a/libraries/ArduinoOTA/ArduinoOTA.cpp +++ b/libraries/ArduinoOTA/ArduinoOTA.cpp @@ -106,7 +106,7 @@ void ArduinoOTAClass::setRebootOnSuccess(bool reboot){ _rebootOnSuccess = reboot; } -void ArduinoOTAClass::begin(bool useMDNS) { +bool ArduinoOTAClass::begin(bool useMDNS) { if (_initialized) return; @@ -126,11 +126,13 @@ void ArduinoOTAClass::begin(bool useMDNS) { _udp_ota = 0; } - _udp_ota = new UdpContext; + _udp_ota = new (std::nothrow) UdpContext; + if (_udp_ota == nullptr) + return false; _udp_ota->ref(); if(!_udp_ota->listen(IP_ADDR_ANY, _port)) - return; + return false; _udp_ota->onRx(std::bind(&ArduinoOTAClass::_onRx, this)); #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS) @@ -149,6 +151,7 @@ void ArduinoOTAClass::begin(bool useMDNS) { #ifdef OTA_DEBUG OTA_DEBUG.printf("OTA server at: %s.local:%u\n", _hostname.c_str(), _port); #endif + return true; } int ArduinoOTAClass::parseInt(){ diff --git a/libraries/DNSServer/src/DNSServer.cpp b/libraries/DNSServer/src/DNSServer.cpp index 2113ae0f5b..8d7b3dfb06 100644 --- a/libraries/DNSServer/src/DNSServer.cpp +++ b/libraries/DNSServer/src/DNSServer.cpp @@ -178,8 +178,7 @@ void DNSServer::processNextRequest() return; std::unique_ptr buffer(new (std::nothrow) uint8_t[currentPacketSize]); - - if (buffer == NULL) + if (buffer == nullptr) return; _udp.read(buffer.get(), currentPacketSize); diff --git a/libraries/EEPROM/EEPROM.cpp b/libraries/EEPROM/EEPROM.cpp index 90bbf8ca52..c0cedb8350 100644 --- a/libraries/EEPROM/EEPROM.cpp +++ b/libraries/EEPROM/EEPROM.cpp @@ -64,9 +64,12 @@ void EEPROMClass::begin(size_t size) { //In case begin() is called a 2nd+ time, don't reallocate if size is the same if(_data && size != _size) { delete[] _data; - _data = new uint8_t[size]; + _data = new (std::nothrow) uint8_t[size]; } else if(!_data) { - _data = new uint8_t[size]; + _data = new (std::nothrow) uint8_t[size]; + } + if (_data == nullptr) { + return; } _size = size; diff --git a/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino b/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino index 2d6f49592b..7940ec7f88 100644 --- a/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino +++ b/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino @@ -41,7 +41,10 @@ void loop() { // wait for WiFi connection if ((WiFiMulti.run() == WL_CONNECTED)) { - std::unique_ptrclient(new BearSSL::WiFiClientSecure); + std::unique_ptrclient(new (std::nothrow) BearSSL::WiFiClientSecure); + if (client == nullptr) { + return; + } client->setFingerprint(fingerprint); diff --git a/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino b/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino index a69b9e35c6..9d92b0c830 100644 --- a/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino +++ b/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino @@ -38,7 +38,10 @@ void loop() { // wait for WiFi connection if ((WiFiMulti.run() == WL_CONNECTED)) { - std::unique_ptr client(new BearSSL::WiFiClientSecure); + std::unique_ptr client(new (std::nothrow) BearSSL::WiFiClientSecure); + if (client == nullptr) { + return; + } bool mfln = client->probeMaxFragmentLength("tls.mbed.org", 443, 1024); Serial.printf("\nConnecting to https://tls.mbed.org\n"); diff --git a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp index 74bc3be173..84770ee5c1 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp @@ -37,7 +37,7 @@ class TransportTraits virtual std::unique_ptr create() { - return std::unique_ptr(new WiFiClient()); + return std::unique_ptr(new (std::nothrow) WiFiClient()); } virtual bool verify(WiFiClient& client, const char* host) @@ -59,8 +59,9 @@ class BearSSLTraits : public TransportTraits std::unique_ptr create() override { - BearSSL::WiFiClientSecure *client = new BearSSL::WiFiClientSecure(); - client->setFingerprint(_fingerprint); + BearSSL::WiFiClientSecure *client = new (std::nothrow) BearSSL::WiFiClientSecure(); + if (client != nullptr) + client->setFingerprint(_fingerprint); return std::unique_ptr(client); } @@ -182,7 +183,7 @@ bool HTTPClient::begin(String url, const uint8_t httpsFingerprint[20]) if (!beginInternal(url, "https")) { return false; } - _transportTraits = TransportTraitsPtr(new BearSSLTraits(httpsFingerprint)); + _transportTraits = TransportTraitsPtr(new (std::nothrow) BearSSLTraits(httpsFingerprint)); if(!_transportTraits) { DEBUG_HTTPCLIENT("[HTTP-Client][begin] could not create transport traits\n"); return false; @@ -212,8 +213,8 @@ bool HTTPClient::begin(String url) if (!beginInternal(url, "http")) { return false; } - _transportTraits = TransportTraitsPtr(new TransportTraits()); - return true; + _transportTraits = TransportTraitsPtr(new (std::nothrow) TransportTraits()); + return _transportTraits != nullptr; } @@ -290,9 +291,9 @@ bool HTTPClient::begin(String host, uint16_t port, String uri) _host = host; _port = port; _uri = uri; - _transportTraits = TransportTraitsPtr(new TransportTraits()); + _transportTraits = TransportTraitsPtr(new (std::nothrow) TransportTraits()); DEBUG_HTTPCLIENT("[HTTP-Client][begin] host: %s port: %d uri: %s\n", host.c_str(), port, uri.c_str()); - return true; + return _transportTraits != nullptr; } @@ -309,13 +310,13 @@ bool HTTPClient::begin(String host, uint16_t port, String uri, const uint8_t htt _port = port; _uri = uri; - _transportTraits = TransportTraitsPtr(new BearSSLTraits(httpsFingerprint)); + _transportTraits = TransportTraitsPtr(new (std::nothrow) BearSSLTraits(httpsFingerprint)); DEBUG_HTTPCLIENT("[HTTP-Client][begin] host: %s port: %d url: %s BearSSL-httpsFingerprint:", host.c_str(), port, uri.c_str()); for (size_t i=0; i < 20; i++) { DEBUG_HTTPCLIENT(" %02x", httpsFingerprint[i]); } DEBUG_HTTPCLIENT("\n"); - return true; + return _transportTraits != nullptr; } diff --git a/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino b/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino index a2514e171d..dd19e56238 100644 --- a/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino +++ b/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino @@ -106,7 +106,7 @@ void setup() MDNS.begin(host); - httpServer.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey)); + httpServer.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey)); httpUpdater.setup(&httpServer, update_path, update_username, update_password); httpServer.begin(); diff --git a/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp b/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp index ac8582c579..f693670338 100644 --- a/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp +++ b/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp @@ -116,7 +116,9 @@ bool LLMNRResponder::_restart() { if (igmp_joingroup(IP4_ADDR_ANY4, llmnr) != ERR_OK) return false; - _conn = new UdpContext; + _conn = new (std::nothrow) UdpContext; + if (!_conn) + return false; _conn->ref(); if (!_conn->listen(IP_ADDR_ANY, LLMNR_PORT)) diff --git a/libraries/ESP8266SSDP/ESP8266SSDP.cpp b/libraries/ESP8266SSDP/ESP8266SSDP.cpp index 93121ffc8c..e0b5a5d647 100644 --- a/libraries/ESP8266SSDP/ESP8266SSDP.cpp +++ b/libraries/ESP8266SSDP/ESP8266SSDP.cpp @@ -175,7 +175,10 @@ bool SSDPClass::begin() { assert(NULL == _server); - _server = new UdpContext; + _server = new (std::nothrow) UdpContext; + if (_server == nullptr) { + return false; + } _server->ref(); IPAddress local = WiFi.localIP(); @@ -508,7 +511,9 @@ void SSDPClass::_onTimerStatic(SSDPClass* self) { void SSDPClass::_startTimer() { _stopTimer(); - _timer = new SSDPTimer(); + _timer = new (std::nothrow) SSDPTimer(); + if (_timer == nullptr) + return; ETSTimer* tm = &(_timer->timer); const int interval = 1000; os_timer_disarm(tm); diff --git a/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino b/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino index 4b786dc1a5..c6c0d5563c 100644 --- a/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino +++ b/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino @@ -128,7 +128,7 @@ void setup(void){ Serial.println("MDNS responder started"); } - server.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey)); + server.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey)); server.on("/", handleRoot); diff --git a/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino b/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino index c2ceaca53d..0671b122ed 100644 --- a/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino +++ b/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino @@ -111,7 +111,7 @@ void setup() { ESP.restart(); } - server.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey)); + server.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey)); server.on("/",showcredentialpage); //for this simple example, just show a simple page for changing credentials at the root server.on("/" + change_creds,handlecredentialchange); //handles submission of credentials from the client server.onNotFound(redirect); diff --git a/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h b/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h index 218fd168af..b85899610b 100644 --- a/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h +++ b/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h @@ -126,12 +126,12 @@ bool ESP8266WebServerTemplate::authenticate(const char * username, c authReq = authReq.substring(6); authReq.trim(); char toencodeLen = strlen(username)+strlen(password)+1; - char *toencode = new char[toencodeLen + 1]; + char *toencode = new (std::nothrow) char[toencodeLen + 1]; if(toencode == NULL){ authReq = ""; return false; } - char *encoded = new char[base64_encode_expected_len(toencodeLen)+1]; + char *encoded = new (std::nothrow) char[base64_encode_expected_len(toencodeLen)+1]; if(encoded == NULL){ authReq = ""; delete[] toencode; @@ -266,7 +266,7 @@ void ESP8266WebServerTemplate::on(const Uri &uri, HTTPMethod method, template void ESP8266WebServerTemplate::on(const Uri &uri, HTTPMethod method, ESP8266WebServerTemplate::THandlerFunction fn, ESP8266WebServerTemplate::THandlerFunction ufn) { - _addRequestHandler(new FunctionRequestHandler(fn, ufn, uri, method)); + _addRequestHandler(new (std::nothrow) FunctionRequestHandler(fn, ufn, uri, method)); } template @@ -288,7 +288,7 @@ void ESP8266WebServerTemplate::_addRequestHandler(RequestHandlerType template void ESP8266WebServerTemplate::serveStatic(const char* uri, FS& fs, const char* path, const char* cache_header) { - _addRequestHandler(new StaticRequestHandler(fs, path, uri, cache_header)); + _addRequestHandler(new (std::nothrow) StaticRequestHandler(fs, path, uri, cache_header)); } template @@ -645,7 +645,9 @@ void ESP8266WebServerTemplate::collectHeaders(const char* headerKeys _headerKeysCount = headerKeysCount + 1; if (_currentHeaders) delete[]_currentHeaders; - _currentHeaders = new RequestArgument[_headerKeysCount]; + _currentHeaders = new (std::nothrow) RequestArgument[_headerKeysCount]; + if (_currentHeaders == nullptr) + return; _currentHeaders[0].key = FPSTR(AUTHORIZATION_HEADER); for (int i = 1; i < _headerKeysCount; i++){ _currentHeaders[i].key = headerKeys[i-1]; diff --git a/libraries/ESP8266WebServer/src/Parsing-impl.h b/libraries/ESP8266WebServer/src/Parsing-impl.h index 4bb6db8878..3eb170b448 100644 --- a/libraries/ESP8266WebServer/src/Parsing-impl.h +++ b/libraries/ESP8266WebServer/src/Parsing-impl.h @@ -283,7 +283,9 @@ void ESP8266WebServerTemplate::_parseArguments(const String& data) { _currentArgCount = _parseArgumentsPrivate(data, nullArgHandler()); // allocate one more, this is needed because {"plain": plainBuf} is always added - _currentArgs = new RequestArgument[_currentArgCount + 1]; + _currentArgs = new (std::nothrow) RequestArgument[_currentArgCount + 1]; + if (_currentArgs == nullptr) + return; (void)_parseArgumentsPrivate(data, storeArgHandler()); } @@ -370,7 +372,11 @@ bool ESP8266WebServerTemplate::_parseForm(ClientType& client, const //start reading the form if (line == ("--"+boundary)){ if(_postArgs) delete[] _postArgs; - _postArgs = new RequestArgument[WEBSERVER_MAX_POST_ARGS]; + _postArgs = new (std::nothrow) RequestArgument[WEBSERVER_MAX_POST_ARGS]; + if (_postArgs == nullptr) { + DBGWS("Parse form: oom\n"); + return false; + } _postArgsLen = 0; while(1){ String argName; @@ -428,7 +434,11 @@ bool ESP8266WebServerTemplate::_parseForm(ClientType& client, const break; } } else { - _currentUpload.reset(new HTTPUpload()); + _currentUpload.reset(new (std::nothrow) HTTPUpload()); + if (_currentUpload == nullptr) { + DBGWS("Parse form: oom\n"); + return false; + } _currentUpload->status = UPLOAD_FILE_START; _currentUpload->name = argName; _currentUpload->filename = argFilename; @@ -521,7 +531,9 @@ bool ESP8266WebServerTemplate::_parseForm(ClientType& client, const arg.value = _currentArgs[iarg].value; } if (_currentArgs) delete[] _currentArgs; - _currentArgs = new RequestArgument[_postArgsLen]; + _currentArgs = new (std::nothrow) RequestArgument[_postArgsLen]; + if (_currentArgs == nullptr) + return false; for (iarg = 0; iarg < _postArgsLen; iarg++){ RequestArgument& arg = _currentArgs[iarg]; arg.key = _postArgs[iarg].key; diff --git a/libraries/ESP8266WebServer/src/Uri.h b/libraries/ESP8266WebServer/src/Uri.h index 95f5c89360..6b0fa998b8 100644 --- a/libraries/ESP8266WebServer/src/Uri.h +++ b/libraries/ESP8266WebServer/src/Uri.h @@ -16,7 +16,7 @@ class Uri { virtual ~Uri() {} virtual Uri* clone() const { - return new Uri(_uri); + return new (std::nothrow) Uri(_uri); }; virtual bool canHandle(const String &requestUri, __attribute__((unused)) std::vector &pathArgs) { diff --git a/libraries/ESP8266WebServer/src/uri/UriBraces.h b/libraries/ESP8266WebServer/src/uri/UriBraces.h index 29652efc7f..fa32d6be99 100644 --- a/libraries/ESP8266WebServer/src/uri/UriBraces.h +++ b/libraries/ESP8266WebServer/src/uri/UriBraces.h @@ -10,7 +10,7 @@ class UriBraces : public Uri { explicit UriBraces(const String &uri) : Uri(uri) {}; Uri* clone() const override final { - return new UriBraces(_uri); + return new (std::nothrow) UriBraces(_uri); }; bool canHandle(const String &requestUri, std::vector &pathArgs) override final { diff --git a/libraries/ESP8266WebServer/src/uri/UriGlob.h b/libraries/ESP8266WebServer/src/uri/UriGlob.h index 1e222cbabd..8cab6e6bc9 100644 --- a/libraries/ESP8266WebServer/src/uri/UriGlob.h +++ b/libraries/ESP8266WebServer/src/uri/UriGlob.h @@ -11,7 +11,7 @@ class UriGlob : public Uri { explicit UriGlob(const String &uri) : Uri(uri) {}; Uri* clone() const override final { - return new UriGlob(_uri); + return new (std::nothrow) UriGlob(_uri); }; bool canHandle(const String &requestUri, __attribute__((unused)) std::vector &pathArgs) override final { diff --git a/libraries/ESP8266WebServer/src/uri/UriRegex.h b/libraries/ESP8266WebServer/src/uri/UriRegex.h index eef1b516d4..47128eb3a0 100644 --- a/libraries/ESP8266WebServer/src/uri/UriRegex.h +++ b/libraries/ESP8266WebServer/src/uri/UriRegex.h @@ -25,7 +25,7 @@ class UriRegex : public Uri { } Uri* clone() const override final { - return new UriRegex(_uri); + return new (std::nothrow) UriRegex(_uri); }; bool canHandle(const String &requestUri, std::vector &pathArgs) override final { diff --git a/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino b/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino index a599a0395a..fac012404e 100644 --- a/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino +++ b/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino @@ -145,7 +145,7 @@ void setup() { return; // Can't connect to anything w/o certs! } - BearSSL::WiFiClientSecure *bear = new BearSSL::WiFiClientSecure(); + BearSSL::WiFiClientSecure *bear = new (std::nothrow) BearSSL::WiFiClientSecure(); // Integrate the cert store with this connection bear->setCertStore(&certStore); Serial.printf("Attempting to fetch https://github.com/...\n"); @@ -164,7 +164,7 @@ void loop() { site.replace(String("\n"), emptyString); Serial.printf("https://%s/\n", site.c_str()); - BearSSL::WiFiClientSecure *bear = new BearSSL::WiFiClientSecure(); + BearSSL::WiFiClientSecure *bear = new (std::nothrow) BearSSL::WiFiClientSecure(); // Integrate the cert store with this connection bear->setCertStore(&certStore); fetchURL(bear, site.c_str(), 443, "/"); diff --git a/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino b/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino index d27382284d..24249ffb52 100644 --- a/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino +++ b/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino @@ -161,8 +161,8 @@ void setup() { Serial.println(WiFi.localIP()); // Attach the server private cert/key combo - BearSSL::X509List *serverCertList = new BearSSL::X509List(server_cert); - BearSSL::PrivateKey *serverPrivKey = new BearSSL::PrivateKey(server_private_key); + BearSSL::X509List *serverCertList = new (std::nothrow) BearSSL::X509List(server_cert); + BearSSL::PrivateKey *serverPrivKey = new (std::nothrow) BearSSL::PrivateKey(server_private_key); #ifndef USE_EC server.setRSACert(serverCertList, serverPrivKey); #else diff --git a/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino b/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino index a50f115283..48dc6aba9b 100644 --- a/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino +++ b/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino @@ -202,12 +202,12 @@ void setup() { setClock(); // Required for X.509 validation // Attach the server private cert/key combo - BearSSL::X509List *serverCertList = new BearSSL::X509List(server_cert); - BearSSL::PrivateKey *serverPrivKey = new BearSSL::PrivateKey(server_private_key); + BearSSL::X509List *serverCertList = new (std::nothrow) BearSSL::X509List(server_cert); + BearSSL::PrivateKey *serverPrivKey = new (std::nothrow) BearSSL::PrivateKey(server_private_key); server.setRSACert(serverCertList, serverPrivKey); // Require a certificate validated by the trusted CA - BearSSL::X509List *serverTrustedCA = new BearSSL::X509List(ca_cert); + BearSSL::X509List *serverTrustedCA = new (std::nothrow) BearSSL::X509List(ca_cert); server.setClientTrustAnchor(serverTrustedCA); // Actually start accepting connections diff --git a/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino b/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino index 9102af12d8..bf547665e6 100644 --- a/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino +++ b/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino @@ -85,7 +85,7 @@ void setup() { Serial.swap(); // Hardware serial is now on RX:GPIO13 TX:GPIO15 // use SoftwareSerial on regular RX(3)/TX(1) for logging - logger = new SoftwareSerial(3, 1); + logger = new (std::nothrow) SoftwareSerial(3, 1); logger->begin(BAUD_LOGGER); logger->enableIntTx(false); logger->println("\n\nUsing SoftwareSerial for logging"); diff --git a/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp b/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp index b3d1b60c20..6ffcca08da 100644 --- a/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp +++ b/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp @@ -109,7 +109,7 @@ namespace brssl { } static bool certificate_to_trust_anchor_inner(br_x509_trust_anchor *ta, const br_x509_certificate *xc) { - std::unique_ptr dc(new br_x509_decoder_context); // auto-delete on exit + std::unique_ptr dc(new (std::nothrow) br_x509_decoder_context); // auto-delete on exit std::vector vdn; br_x509_pkey *pk; @@ -244,7 +244,7 @@ namespace brssl { // blobs may be returned. pem_object *decode_pem(const void *src, size_t len, size_t *num) { std::vector pem_list; - std::unique_ptr pc(new br_pem_decoder_context); // auto-delete on exit + std::unique_ptr pc(new (std::nothrow) br_pem_decoder_context); // auto-delete on exit if (!pc.get()) { return nullptr; } @@ -405,7 +405,7 @@ namespace brssl { } static public_key *decode_public_key(const unsigned char *buff, size_t len) { - std::unique_ptr dc(new br_pkey_decoder_context); // auto-delete on exit + std::unique_ptr dc(new (std::nothrow) br_pkey_decoder_context); // auto-delete on exit if (!dc.get()) { return nullptr; } @@ -477,7 +477,7 @@ namespace brssl { } static private_key *decode_private_key(const unsigned char *buff, size_t len) { - std::unique_ptr dc(new br_skey_decoder_context); // auto-delete on exit + std::unique_ptr dc(new (std::nothrow) br_skey_decoder_context); // auto-delete on exit if (!dc.get()) { return nullptr; } diff --git a/libraries/ESP8266WiFi/src/CertStoreBearSSL.cpp b/libraries/ESP8266WiFi/src/CertStoreBearSSL.cpp index 905efde2ba..9f3e0ac808 100644 --- a/libraries/ESP8266WiFi/src/CertStoreBearSSL.cpp +++ b/libraries/ESP8266WiFi/src/CertStoreBearSSL.cpp @@ -50,9 +50,13 @@ CertStore::CertInfo CertStore::_preprocessCert(uint32_t length, uint32_t offset, memset(&ci, 0, sizeof(ci)); // Process it using SHA256, same as the hashed_dn - br_x509_decoder_context *ctx = new br_x509_decoder_context; - br_sha256_context *sha256 = new br_sha256_context; + br_x509_decoder_context *ctx = new (std::nothrow) br_x509_decoder_context; + br_sha256_context *sha256 = new (std::nothrow) br_sha256_context; if (!ctx || !sha256) { + if (ctx) + delete ctx; + if (sha256) + delete sha256; DEBUG_BSSL("CertStore::_preprocessCert: OOM\n"); return ci; } @@ -202,7 +206,7 @@ const br_x509_trust_anchor *CertStore::findHashedTA(void *ctx, void *hashed_dn, return nullptr; } data.close(); - cs->_x509 = new X509List(der, ci.length); + cs->_x509 = new (std::nothrow) X509List(der, ci.length); free(der); if (!cs->_x509) { DEBUG_BSSL("CertStore::findHashedTA: OOM\n"); diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp index 65878a3d5b..0eb5889836 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp @@ -308,7 +308,10 @@ void ESP8266WiFiScanClass::_scanDone(void* result, int status) { if(i == 0) { ESP8266WiFiScanClass::_scanResult = 0; } else { - bss_info* copied_info = new bss_info[i]; + bss_info* copied_info = new (std::nothrow) bss_info[i]; + if (copied_info == nullptr) { + return; + } i = 0; for(bss_info* it = head; it; it = STAILQ_NEXT(it, next), ++i) { memcpy(copied_info + i, it, sizeof(bss_info)); diff --git a/libraries/ESP8266WiFi/src/WiFiClient.cpp b/libraries/ESP8266WiFi/src/WiFiClient.cpp index 1663a29ecb..136016b07e 100644 --- a/libraries/ESP8266WiFi/src/WiFiClient.cpp +++ b/libraries/ESP8266WiFi/src/WiFiClient.cpp @@ -153,7 +153,10 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) pcb->local_port = _localPort++; } - _client = new ClientContext(pcb, nullptr, nullptr); + _client = new (std::nothrow) ClientContext(pcb, nullptr, nullptr); + if (_client == nullptr) { + return 0; + } _client->ref(); _client->setTimeout(_timeout); int res = _client->connect(ip, port); diff --git a/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp b/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp index c94ac79e0f..281612f7eb 100644 --- a/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp +++ b/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp @@ -977,7 +977,7 @@ extern "C" { // Set custom list of ciphers bool WiFiClientSecure::setCiphers(const uint16_t *cipherAry, int cipherCount) { _cipher_list = nullptr; - _cipher_list = std::shared_ptr(new uint16_t[cipherCount], std::default_delete()); + _cipher_list = std::shared_ptr(new (std::nothrow) uint16_t[cipherCount], std::default_delete()); if (!_cipher_list.get()) { DEBUG_BSSL("setCiphers: list empty\n"); return false; @@ -1067,8 +1067,8 @@ bool WiFiClientSecure::_connectSSL(const char* hostName) { _sc = std::make_shared(); _eng = &_sc->eng; // Allocation/deallocation taken care of by the _sc shared_ptr - _iobuf_in = std::shared_ptr(new unsigned char[_iobuf_in_size], std::default_delete()); - _iobuf_out = std::shared_ptr(new unsigned char[_iobuf_out_size], std::default_delete()); + _iobuf_in = std::shared_ptr(new (std::nothrow) unsigned char[_iobuf_in_size], std::default_delete()); + _iobuf_out = std::shared_ptr(new (std::nothrow) unsigned char[_iobuf_out_size], std::default_delete()); if (!_sc || !_iobuf_in || !_iobuf_out) { _freeSSL(); // Frees _sc, _iobuf* @@ -1183,8 +1183,8 @@ bool WiFiClientSecure::_connectSSLServerRSA(const X509List *chain, _oom_err = false; _sc_svr = std::make_shared(); _eng = &_sc_svr->eng; // Allocation/deallocation taken care of by the _sc shared_ptr - _iobuf_in = std::shared_ptr(new unsigned char[_iobuf_in_size], std::default_delete()); - _iobuf_out = std::shared_ptr(new unsigned char[_iobuf_out_size], std::default_delete()); + _iobuf_in = std::shared_ptr(new (std::nothrow) unsigned char[_iobuf_in_size], std::default_delete()); + _iobuf_out = std::shared_ptr(new (std::nothrow) unsigned char[_iobuf_out_size], std::default_delete()); if (!_sc_svr || !_iobuf_in || !_iobuf_out) { _freeSSL(); @@ -1220,8 +1220,8 @@ bool WiFiClientSecure::_connectSSLServerEC(const X509List *chain, _oom_err = false; _sc_svr = std::make_shared(); _eng = &_sc_svr->eng; // Allocation/deallocation taken care of by the _sc shared_ptr - _iobuf_in = std::shared_ptr(new unsigned char[_iobuf_in_size], std::default_delete()); - _iobuf_out = std::shared_ptr(new unsigned char[_iobuf_out_size], std::default_delete()); + _iobuf_in = std::shared_ptr(new (std::nothrow) unsigned char[_iobuf_in_size], std::default_delete()); + _iobuf_out = std::shared_ptr(new (std::nothrow) unsigned char[_iobuf_out_size], std::default_delete()); if (!_sc_svr || !_iobuf_in || !_iobuf_out) { _freeSSL(); @@ -1421,7 +1421,7 @@ bool WiFiClientSecure::probeMaxFragmentLength(IPAddress ip, uint16_t port, uint1 default: return false; // Invalid size } int ttlLen = sizeof(clientHelloHead_P) + (2 + sizeof(suites_P)) + (sizeof(clientHelloTail_P) + 1); - uint8_t *clientHello = new uint8_t[ttlLen]; + uint8_t *clientHello = new (std::nothrow) uint8_t[ttlLen]; if (!clientHello) { DEBUG_BSSL("probeMaxFragmentLength: OOM\n"); return false; @@ -1580,21 +1580,21 @@ bool WiFiClientSecure::probeMaxFragmentLength(IPAddress ip, uint16_t port, uint1 // AXTLS compatibility interfaces bool WiFiClientSecure::setCACert(const uint8_t* pk, size_t size) { _axtls_ta = nullptr; - _axtls_ta = std::shared_ptr(new X509List(pk, size)); + _axtls_ta = std::shared_ptr(new (std::nothrow) X509List(pk, size)); _ta = _axtls_ta.get(); return _ta ? true : false; } bool WiFiClientSecure::setCertificate(const uint8_t* pk, size_t size) { _axtls_chain = nullptr; - _axtls_chain = std::shared_ptr(new X509List(pk, size)); + _axtls_chain = std::shared_ptr(new (std::nothrow) X509List(pk, size)); _chain = _axtls_chain.get(); return _chain ? true : false; } bool WiFiClientSecure::setPrivateKey(const uint8_t* pk, size_t size) { _axtls_sk = nullptr; - _axtls_sk = std::shared_ptr(new PrivateKey(pk, size)); + _axtls_sk = std::shared_ptr(new (std::nothrow) PrivateKey(pk, size)); _sk = _axtls_sk.get(); return _sk ? true : false; diff --git a/libraries/ESP8266WiFi/src/WiFiServer.cpp b/libraries/ESP8266WiFi/src/WiFiServer.cpp index 2ee09f85fe..1ec78fed7f 100644 --- a/libraries/ESP8266WiFi/src/WiFiServer.cpp +++ b/libraries/ESP8266WiFi/src/WiFiServer.cpp @@ -186,7 +186,10 @@ long WiFiServer::_accept(tcp_pcb* apcb, long err) { // always accept new PCB so incoming data can be stored in our buffers even before // user calls ::available() - ClientContext* client = new ClientContext(apcb, &WiFiServer::_s_discard, this); + ClientContext* client = new (std::nothrow) ClientContext(apcb, &WiFiServer::_s_discard, this); + if (client == nullptr) { + return ERR_MEM; + } // backlog doc: // http://lwip.100.n7.nabble.com/Problem-re-opening-listening-pbc-tt32484.html#a32494 diff --git a/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp b/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp index 087c90b4e8..b4cb0e0e9c 100644 --- a/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp +++ b/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp @@ -107,8 +107,8 @@ WiFiClientSecure WiFiServerSecure::available(uint8_t* status) { void WiFiServerSecure::setServerKeyAndCert(const uint8_t *key, int keyLen, const uint8_t *cert, int certLen) { _axtls_chain = nullptr; _axtls_sk = nullptr; - _axtls_chain = std::shared_ptr(new X509List(cert, certLen)); - _axtls_sk = std::shared_ptr(new PrivateKey(key, keyLen)); + _axtls_chain = std::shared_ptr(new (std::nothrow) X509List(cert, certLen)); + _axtls_sk = std::shared_ptr(new (std::nothrow) PrivateKey(key, keyLen)); setRSACert(_axtls_chain.get(), _axtls_sk.get()); } diff --git a/libraries/ESP8266WiFi/src/WiFiUdp.cpp b/libraries/ESP8266WiFi/src/WiFiUdp.cpp index a0a5c1d4e4..8bbcddb278 100644 --- a/libraries/ESP8266WiFi/src/WiFiUdp.cpp +++ b/libraries/ESP8266WiFi/src/WiFiUdp.cpp @@ -80,7 +80,10 @@ uint8_t WiFiUDP::begin(uint16_t port) _ctx = 0; } - _ctx = new UdpContext; + _ctx = new (std::nothrow) UdpContext; + if (_ctx == nullptr) { + return 0; + } _ctx->ref(); return (_ctx->listen(IPAddress(), port)) ? 1 : 0; } @@ -96,7 +99,10 @@ uint8_t WiFiUDP::beginMulticast(IPAddress interfaceAddr, IPAddress multicast, ui return 0; } - _ctx = new UdpContext; + _ctx = new (std::nothrow) UdpContext; + if (_ctx == nullptr) { + return 0; + } _ctx->ref(); ip_addr_t addr = IPADDR4_INIT(INADDR_ANY); if (!_ctx->listen(&addr, port)) { @@ -147,7 +153,10 @@ int WiFiUDP::beginPacket(const char *host, uint16_t port) int WiFiUDP::beginPacket(IPAddress ip, uint16_t port) { if (!_ctx) { - _ctx = new UdpContext; + _ctx = new (std::nothrow) UdpContext; + if (_ctx == nullptr) { + return 0; + } _ctx->ref(); } return (_ctx->connect(ip, port)) ? 1 : 0; @@ -157,7 +166,10 @@ int WiFiUDP::beginPacketMulticast(IPAddress multicastAddress, uint16_t port, IPAddress interfaceAddress, int ttl) { if (!_ctx) { - _ctx = new UdpContext; + _ctx = new (std::nothrow) UdpContext; + if (_ctx == nullptr) { + return 0; + } _ctx->ref(); } if (!_ctx->connect(multicastAddress, port)) { diff --git a/libraries/ESP8266WiFi/src/include/ClientContext.h b/libraries/ESP8266WiFi/src/include/ClientContext.h index 8095e402a2..47407bc00b 100644 --- a/libraries/ESP8266WiFi/src/include/ClientContext.h +++ b/libraries/ESP8266WiFi/src/include/ClientContext.h @@ -374,7 +374,7 @@ class ClientContext if (!_pcb) { return 0; } - return _write_from_source(new BufferDataSource(data, size)); + return _write_from_source(new (std::nothrow) BufferDataSource(data, size)); } size_t write(Stream& stream) @@ -382,7 +382,7 @@ class ClientContext if (!_pcb) { return 0; } - return _write_from_source(new BufferedStreamDataSource(stream, stream.available())); + return _write_from_source(new (std::nothrow) BufferedStreamDataSource(stream, stream.available())); } size_t write_P(PGM_P buf, size_t size) @@ -391,7 +391,7 @@ class ClientContext return 0; } ProgmemStream stream(buf, size); - return _write_from_source(new BufferedStreamDataSource(stream, size)); + return _write_from_source(new (std::nothrow) BufferedStreamDataSource(stream, size)); } void keepAlive (uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT) diff --git a/libraries/ESP8266WiFi/src/include/DataSource.h b/libraries/ESP8266WiFi/src/include/DataSource.h index 2a0bfed260..624a9277e7 100644 --- a/libraries/ESP8266WiFi/src/include/DataSource.h +++ b/libraries/ESP8266WiFi/src/include/DataSource.h @@ -75,7 +75,7 @@ class BufferedStreamDataSource : public DataSource { //Buffer too small? if (_bufferSize < min_buffer_size) { - uint8_t *new_buffer = new uint8_t[min_buffer_size]; + uint8_t *new_buffer = new (std::nothrow) uint8_t[min_buffer_size]; //If stream reading is ahead, than some data is already in the old buffer and needs to be copied to new resized buffer if (_buffer && stream_read > 0) { memcpy(new_buffer, _buffer.get(), stream_read); diff --git a/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino b/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino index e196ef6419..26fd06fbdf 100644 --- a/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino +++ b/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino @@ -74,9 +74,9 @@ void setup() { WiFiMulti.addAP(STASSID, STAPSK); #if MANUAL_SIGNING - signPubKey = new BearSSL::PublicKey(pubkey); - hash = new BearSSL::HashSHA256(); - sign = new BearSSL::SigningVerifier(signPubKey); + signPubKey = new (std::nothrow) BearSSL::PublicKey(pubkey); + hash = new (std::nothrow) BearSSL::HashSHA256(); + sign = new (std::nothrow) BearSSL::SigningVerifier(signPubKey); #endif } diff --git a/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp b/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp index 8791195523..c15ead17bb 100644 --- a/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp +++ b/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp @@ -225,7 +225,11 @@ bool MDNSResponder::_listen() return false; } - _conn = new UdpContext; + _conn = new (std::nothrow) UdpContext; + if (_conn == nullptr) + { + return false; + } _conn->ref(); if (!_conn->listen(IP_ADDR_ANY, MDNS_PORT)) @@ -276,7 +280,11 @@ bool MDNSResponder::addServiceTxt(char *name, char *proto, char *key, char *valu { return false; //max txt record size } - MDNSTxt *newtxt = new MDNSTxt; + MDNSTxt *newtxt = new (std::nothrow) MDNSTxt; + if (newtxt == nullptr) + { + return false; + } newtxt->_txt = String(key) + '=' + String(value); newtxt->_next = 0; if (servicePtr->_txts == 0) //no services have been added diff --git a/libraries/LittleFS/src/LittleFS.cpp b/libraries/LittleFS/src/LittleFS.cpp index 7fd4351fcb..6de443fff3 100644 --- a/libraries/LittleFS/src/LittleFS.cpp +++ b/libraries/LittleFS/src/LittleFS.cpp @@ -203,7 +203,7 @@ int LittleFSImpl::lfs_flash_sync(const struct lfs_config *c) { #endif #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_LITTLEFS) -FS LittleFS = FS(FSImplPtr(new littlefs_impl::LittleFSImpl(FS_PHYS_ADDR, FS_PHYS_SIZE, FS_PHYS_PAGE, FS_PHYS_BLOCK, FS_MAX_OPEN_FILES))); +FS LittleFS = FS(FSImplPtr(new (std::nothrow) littlefs_impl::LittleFSImpl(FS_PHYS_ADDR, FS_PHYS_SIZE, FS_PHYS_PAGE, FS_PHYS_BLOCK, FS_MAX_OPEN_FILES))); extern "C" void littlefs_request_end(void) { diff --git a/libraries/LittleFS/src/LittleFS.h b/libraries/LittleFS/src/LittleFS.h index f78680f662..7af4c0e2b9 100644 --- a/libraries/LittleFS/src/LittleFS.h +++ b/libraries/LittleFS/src/LittleFS.h @@ -324,7 +324,11 @@ class LittleFSFileImpl : public FileImpl { public: LittleFSFileImpl(LittleFSImpl* fs, const char *name, std::shared_ptr fd, int flags, time_t creation) : _fs(fs), _fd(fd), _opened(true), _flags(flags), _creation(creation) { - _name = std::shared_ptr(new char[strlen(name) + 1], std::default_delete()); + _name = std::shared_ptr(new (std::nothrow) char[strlen(name) + 1], std::default_delete()); + if (!_name) { + close(); + return; + } strcpy(_name.get(), name); } @@ -517,17 +521,26 @@ class LittleFSDirImpl : public DirImpl { memset(&_dirent, 0, sizeof(_dirent)); if (dirPath) { - _dirPath = std::shared_ptr(new char[strlen(dirPath) + 1], std::default_delete()); + _dirPath = std::shared_ptr(new (std::nothrow) char[strlen(dirPath) + 1], std::default_delete()); + if (_dirPath == nullptr) { + close(); + return; + } strcpy(_dirPath.get(), dirPath); } } - ~LittleFSDirImpl() override { + void close () { if (_opened) { lfs_dir_close(_fs->getFS(), _getDir()); + _opened = false; } } + ~LittleFSDirImpl() override { + close(); + } + FileImplPtr openFile(OpenMode openMode, AccessMode accessMode) override { if (!_valid) { return FileImplPtr(); diff --git a/libraries/SDFS/src/SDFS.cpp b/libraries/SDFS/src/SDFS.cpp index d862ff5d89..90ef270dcc 100644 --- a/libraries/SDFS/src/SDFS.cpp +++ b/libraries/SDFS/src/SDFS.cpp @@ -32,7 +32,7 @@ using namespace fs; #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SDFS) -FS SDFS = FS(FSImplPtr(new sdfs::SDFSImpl())); +FS SDFS = FS(FSImplPtr(new (std::nothrow) sdfs::SDFSImpl())); #endif namespace sdfs { diff --git a/libraries/esp8266/examples/ConfigFile/ConfigFile.ino b/libraries/esp8266/examples/ConfigFile/ConfigFile.ino index cb1d25be07..d03c19790a 100644 --- a/libraries/esp8266/examples/ConfigFile/ConfigFile.ino +++ b/libraries/esp8266/examples/ConfigFile/ConfigFile.ino @@ -25,7 +25,10 @@ bool loadConfig() { } // Allocate a buffer to store contents of the file. - std::unique_ptr buf(new char[size]); + std::unique_ptr buf(new (std::nothrow) char[size]); + if (buf == nullptr) { + return false; + } // We don't use String here because ArduinoJson library requires the input // buffer to be mutable. If you don't use ArduinoJson, you may as well diff --git a/libraries/esp8266/examples/SerialStress/SerialStress.ino b/libraries/esp8266/examples/SerialStress/SerialStress.ino index 1412abd2be..b93e443601 100644 --- a/libraries/esp8266/examples/SerialStress/SerialStress.ino +++ b/libraries/esp8266/examples/SerialStress/SerialStress.ino @@ -72,7 +72,7 @@ void setup() { // using HardwareSerial0 pins, // so we can still log to the regular usbserial chips - SoftwareSerial* ss = new SoftwareSerial(3, 1); + SoftwareSerial* ss = new (std::nothrow) SoftwareSerial(3, 1); ss->begin(SSBAUD); ss->enableIntTx(false); logger = ss; From 385bfd76356e17d211a7eaee77c238b6ba9eb368 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Mon, 17 Aug 2020 18:23:44 +0200 Subject: [PATCH 2/8] deleted: arduino_new/arduino_new.ino --- .../examples/arduino_new/arduino_new.ino | 159 ------------------ 1 file changed, 159 deletions(-) delete mode 100644 libraries/esp8266/examples/arduino_new/arduino_new.ino diff --git a/libraries/esp8266/examples/arduino_new/arduino_new.ino b/libraries/esp8266/examples/arduino_new/arduino_new.ino deleted file mode 100644 index e31c56378b..0000000000 --- a/libraries/esp8266/examples/arduino_new/arduino_new.ino +++ /dev/null @@ -1,159 +0,0 @@ - -// show arduino_new benefits -// released to public domain -// result is below - -class SomeClass { - public: - SomeClass(const String& s1 = emptyString, const String& s2 = emptyString) { - Serial.printf("SomeClass@%p(%s)(%s)\n", this, s1.c_str(), s2.c_str()); - } - - ~SomeClass() { - Serial.printf("~ SomeClass @%p\n", this); - } -}; - -class oom { - private: - char large [65000]; - public: - oom() { - Serial.printf("this constructor should not be called\n"); - } -}; - -void setup() { - - Serial.begin(115200); - Serial.printf("\n\narduino_new benefits\n\n"); - delay(5000); // avoid too frequent bootloop - - // arduino_new / arduino_newarray api - - Serial.printf("\n----- arduino_new:\n"); - auto an = arduino_new(SomeClass); - delete an; - - Serial.printf("\n----- arduino_new with oom:\n"); - auto anoom = arduino_new(oom); - Serial.printf("nullptr: %p\n", anoom); - delete anoom; - - Serial.printf("\n----- arduino_new with constructor parameters:\n"); - auto ancp = arduino_new(SomeClass, "param1", "param2"); - delete ancp; - - Serial.printf("\n----- arduino_newarray[2]\n"); - auto ana2 = arduino_newarray(SomeClass, 2); - Serial.printf("@:%p s=%zd s(2)=%zd\n", ana2, sizeof(SomeClass), sizeof(SomeClass[2])); - Serial.printf("0: %p\n", &ana2[0]); - Serial.printf("1: %p\n", &ana2[1]); - delete [] ana2; - - Serial.printf("\n----- arduino_newarray[2] (with constructor parameters)\n"); - auto ana2cp = arduino_newarray(SomeClass, 2, "param1"); - Serial.printf("@:%p s=%zd s(2)=%zd\n", ana2cp, sizeof(SomeClass), sizeof(SomeClass[2])); - Serial.printf("0: %p\n", &ana2cp[0]); - Serial.printf("1: %p\n", &ana2cp[1]); - delete [] ana2cp; - - Serial.printf("\n----- arduino_newarray[100000]\n"); - auto anaX = arduino_newarray(SomeClass, 100000); - Serial.printf("@:%p\n", anaX); - - // standard c++ api for new and new[] - - Serial.printf("\n----- new\n"); - auto sn = new SomeClass; - delete sn; - - Serial.printf("\n----- new with oom: (abort() with option 'Exceptions: Disabled (new can abort)'\n"); - auto snoom = new oom; - Serial.printf("nullptr: %p\n", snoom); - delete snoom; - - Serial.printf("\n----- new[2]\n"); - auto sna2 = new SomeClass[2]; - Serial.printf("@:%p s=%zd s(2)=%zd\n", sna2, sizeof(SomeClass), sizeof(SomeClass[2])); - Serial.printf("0: %p\n", &sna2[0]); - Serial.printf("1: %p\n", &sna2[1]); - delete [] sna2; - - Serial.printf("\n----- new[10000] (badly fails with 'Exceptions: Legacy' or '...Disabled'\n"); - auto snaX = new SomeClass[100000]; - Serial.printf("@:%p\n", snaX); -} - -void loop() { -} - -////////////////////////////// -/* - - Result with: - Exceptions: Legacy(new can return nullptr) - - ////////////////////////////// - - arduino_new benefits - - ----- arduino_new: - SomeClass@0x3fff1864()() - ~ SomeClass @0x3fff1864 - - ----- arduino_new with oom: - nullptr: 0 - - ----- arduino_new with constructor parameters: - SomeClass@0x3fff1864(param1)(param2) - ~ SomeClass @0x3fff1864 - - ----- arduino_newarray[2] - SomeClass@0x3fff1868()() - SomeClass@0x3fff1869()() - @: 0x3fff1868 s = 1 s(2) = 2 - 0: 0x3fff1868 - 1: 0x3fff1869 - ~ SomeClass @0x3fff1869 - ~ SomeClass @0x3fff1868 - - ----- arduino_newarray[2](with constructor parameters) - SomeClass@0x3fff1868(param1)() - SomeClass@0x3fff1869(param1)() - @: 0x3fff1868 s = 1 s(2) = 2 - 0: 0x3fff1868 - 1: 0x3fff1869 - ~ SomeClass @0x3fff1869 - ~ SomeClass @0x3fff1868 - - ----- arduino_newarray[100000] - @: 0 - - ----- new - SomeClass@0x3fff1864()() - ~ SomeClass @0x3fff1864 - - ----- new with oom: (abort() with option 'Exceptions: Disabled (new can abort)' - this constructor should not be called - nullptr: 0 - - ----- new[2] - SomeClass@0x3fff1868()() - SomeClass@0x3fff1869()() - @:0x3fff1868 s = 1 s(2) = 2 - 0: 0x3fff1868 - 1: 0x3fff1869 - ~ SomeClass @0x3fff1869 - ~ SomeClass @0x3fff1868 - - ----- new[10000](badly fails with 'Exceptions: Legacy' or '...Disabled' - - Exception(29): - epc1 = 0x402013de epc2 = 0x00000000 epc3 = 0x00000000 excvaddr = 0x00000000 depc = 0x00000000 - - >>> stack >>> - ... - -*/ -///////////////////////////// From a16e1e5b8a700bfa0a886685d9d9f59e37fe406b Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sun, 23 Aug 2020 19:43:32 +0200 Subject: [PATCH 3/8] fixes --- cores/esp8266/FunctionalInterrupt.h | 4 ++-- cores/esp8266/cbuf.cpp | 1 + libraries/ArduinoOTA/ArduinoOTA.cpp | 2 +- libraries/ArduinoOTA/ArduinoOTA.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cores/esp8266/FunctionalInterrupt.h b/cores/esp8266/FunctionalInterrupt.h index 968793e499..29f49542c3 100644 --- a/cores/esp8266/FunctionalInterrupt.h +++ b/cores/esp8266/FunctionalInterrupt.h @@ -28,8 +28,8 @@ struct ArgStructure { FunctionInfo* functionInfo = nullptr; }; -void attachInterrupt(uint8_t pin, std::function intRoutine, int mode); -void attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode); +bool attachInterrupt(uint8_t pin, std::function intRoutine, int mode); +bool attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode); #endif //INTERRUPTS_H diff --git a/cores/esp8266/cbuf.cpp b/cores/esp8266/cbuf.cpp index 5f394f9dfc..b9a2880e30 100644 --- a/cores/esp8266/cbuf.cpp +++ b/cores/esp8266/cbuf.cpp @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include // std::nothrow #include "cbuf.h" #include "c_types.h" diff --git a/libraries/ArduinoOTA/ArduinoOTA.cpp b/libraries/ArduinoOTA/ArduinoOTA.cpp index 2a7bd235f6..30f9c413e1 100644 --- a/libraries/ArduinoOTA/ArduinoOTA.cpp +++ b/libraries/ArduinoOTA/ArduinoOTA.cpp @@ -108,7 +108,7 @@ void ArduinoOTAClass::setRebootOnSuccess(bool reboot){ bool ArduinoOTAClass::begin(bool useMDNS) { if (_initialized) - return; + return true; _useMDNS = useMDNS; diff --git a/libraries/ArduinoOTA/ArduinoOTA.h b/libraries/ArduinoOTA/ArduinoOTA.h index 1dfcaeed38..5a84fed230 100644 --- a/libraries/ArduinoOTA/ArduinoOTA.h +++ b/libraries/ArduinoOTA/ArduinoOTA.h @@ -60,7 +60,7 @@ class ArduinoOTAClass void onProgress(THandlerFunction_Progress fn); //Starts the ArduinoOTA service - void begin(bool useMDNS = true); + bool begin(bool useMDNS = true); //Call this in loop() to run the service. Also calls MDNS.update() when begin() or begin(true) is used. void handle(); From 11f7d1766efb85343d69faec21ddddffd2e37f7a Mon Sep 17 00:00:00 2001 From: david gauchard Date: Mon, 24 Aug 2020 09:51:58 +0200 Subject: [PATCH 4/8] remove (std::nothrow) where nullptr case is not handled remove legacy new management --- boards.txt | 170 ++++-------------- cores/esp8266/FunctionalInterrupt.cpp | 38 +--- cores/esp8266/FunctionalInterrupt.h | 4 +- cores/esp8266/Updater.cpp | 2 +- libraries/ArduinoOTA/ArduinoOTA.cpp | 11 +- libraries/ArduinoOTA/ArduinoOTA.h | 2 +- libraries/EEPROM/EEPROM.cpp | 7 +- .../BasicHttpsClient/BasicHttpsClient.ino | 5 +- .../StreamHttpsClient/StreamHttpsClient.ino | 5 +- .../src/ESP8266HTTPClient.cpp | 19 +- .../SecureBearSSLUpdater.ino | 2 +- libraries/ESP8266LLMNR/ESP8266LLMNR.cpp | 4 +- libraries/ESP8266SSDP/ESP8266SSDP.cpp | 9 +- .../HelloServerBearSSL/HelloServerBearSSL.ino | 2 +- .../HttpHashCredAuth/HttpHashCredAuth.ino | 2 +- .../src/ESP8266WebServer-impl.h | 8 +- libraries/ESP8266WebServer/src/Parsing-impl.h | 20 +-- libraries/ESP8266WebServer/src/Uri.h | 2 +- .../ESP8266WebServer/src/uri/UriBraces.h | 2 +- libraries/ESP8266WebServer/src/uri/UriGlob.h | 2 +- libraries/ESP8266WebServer/src/uri/UriRegex.h | 2 +- .../BearSSL_CertStore/BearSSL_CertStore.ino | 4 +- .../BearSSL_Server/BearSSL_Server.ino | 4 +- .../BearSSL_ServerClientCert.ino | 6 +- .../WiFiTelnetToSerial/WiFiTelnetToSerial.ino | 2 +- libraries/ESP8266WiFi/src/BearSSLHelpers.cpp | 8 +- libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp | 5 +- libraries/ESP8266WiFi/src/WiFiClient.cpp | 5 +- .../src/WiFiClientSecureBearSSL.cpp | 6 +- libraries/ESP8266WiFi/src/WiFiServer.cpp | 5 +- .../src/WiFiServerSecureBearSSL.cpp | 4 +- libraries/ESP8266WiFi/src/WiFiUdp.cpp | 20 +-- .../ESP8266WiFi/src/include/ClientContext.h | 6 +- .../ESP8266WiFi/src/include/DataSource.h | 2 +- .../httpUpdateSigned/httpUpdateSigned.ino | 6 +- .../ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp | 12 +- libraries/LittleFS/src/LittleFS.cpp | 2 +- libraries/LittleFS/src/LittleFS.h | 19 +- libraries/SDFS/src/SDFS.cpp | 2 +- .../examples/ConfigFile/ConfigFile.ino | 5 +- .../examples/SerialStress/SerialStress.ino | 2 +- tools/boards.txt.py | 8 +- 42 files changed, 125 insertions(+), 326 deletions(-) diff --git a/boards.txt b/boards.txt index ba4c7e6e04..afd7fb0261 100644 --- a/boards.txt +++ b/boards.txt @@ -49,10 +49,7 @@ generic.menu.vt.heap=Heap generic.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM generic.menu.vt.iram=IRAM generic.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -generic.menu.exception.legacy=Legacy (new can return nullptr) -generic.menu.exception.legacy.build.exception_flags=-fno-exceptions -generic.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -generic.menu.exception.disabled=Disabled (new can abort) +generic.menu.exception.disabled=Disabled (new aborts on oom) generic.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT generic.menu.exception.disabled.build.stdcpp_lib=-lstdc++ generic.menu.exception.enabled=Enabled @@ -521,10 +518,7 @@ esp8285.menu.vt.heap=Heap esp8285.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM esp8285.menu.vt.iram=IRAM esp8285.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -esp8285.menu.exception.legacy=Legacy (new can return nullptr) -esp8285.menu.exception.legacy.build.exception_flags=-fno-exceptions -esp8285.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -esp8285.menu.exception.disabled=Disabled (new can abort) +esp8285.menu.exception.disabled=Disabled (new aborts on oom) esp8285.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT esp8285.menu.exception.disabled.build.stdcpp_lib=-lstdc++ esp8285.menu.exception.enabled=Enabled @@ -859,10 +853,7 @@ espduino.menu.vt.heap=Heap espduino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espduino.menu.vt.iram=IRAM espduino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espduino.menu.exception.legacy=Legacy (new can return nullptr) -espduino.menu.exception.legacy.build.exception_flags=-fno-exceptions -espduino.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -espduino.menu.exception.disabled=Disabled (new can abort) +espduino.menu.exception.disabled=Disabled (new aborts on oom) espduino.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT espduino.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espduino.menu.exception.enabled=Enabled @@ -1048,10 +1039,7 @@ huzzah.menu.vt.heap=Heap huzzah.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM huzzah.menu.vt.iram=IRAM huzzah.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -huzzah.menu.exception.legacy=Legacy (new can return nullptr) -huzzah.menu.exception.legacy.build.exception_flags=-fno-exceptions -huzzah.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -huzzah.menu.exception.disabled=Disabled (new can abort) +huzzah.menu.exception.disabled=Disabled (new aborts on oom) huzzah.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT huzzah.menu.exception.disabled.build.stdcpp_lib=-lstdc++ huzzah.menu.exception.enabled=Enabled @@ -1238,10 +1226,7 @@ inventone.menu.vt.heap=Heap inventone.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM inventone.menu.vt.iram=IRAM inventone.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -inventone.menu.exception.legacy=Legacy (new can return nullptr) -inventone.menu.exception.legacy.build.exception_flags=-fno-exceptions -inventone.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -inventone.menu.exception.disabled=Disabled (new can abort) +inventone.menu.exception.disabled=Disabled (new aborts on oom) inventone.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT inventone.menu.exception.disabled.build.stdcpp_lib=-lstdc++ inventone.menu.exception.enabled=Enabled @@ -1428,10 +1413,7 @@ cw01.menu.vt.heap=Heap cw01.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM cw01.menu.vt.iram=IRAM cw01.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -cw01.menu.exception.legacy=Legacy (new can return nullptr) -cw01.menu.exception.legacy.build.exception_flags=-fno-exceptions -cw01.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -cw01.menu.exception.disabled=Disabled (new can abort) +cw01.menu.exception.disabled=Disabled (new aborts on oom) cw01.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT cw01.menu.exception.disabled.build.stdcpp_lib=-lstdc++ cw01.menu.exception.enabled=Enabled @@ -1621,10 +1603,7 @@ espresso_lite_v1.menu.vt.heap=Heap espresso_lite_v1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espresso_lite_v1.menu.vt.iram=IRAM espresso_lite_v1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espresso_lite_v1.menu.exception.legacy=Legacy (new can return nullptr) -espresso_lite_v1.menu.exception.legacy.build.exception_flags=-fno-exceptions -espresso_lite_v1.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -espresso_lite_v1.menu.exception.disabled=Disabled (new can abort) +espresso_lite_v1.menu.exception.disabled=Disabled (new aborts on oom) espresso_lite_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT espresso_lite_v1.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espresso_lite_v1.menu.exception.enabled=Enabled @@ -1814,10 +1793,7 @@ espresso_lite_v2.menu.vt.heap=Heap espresso_lite_v2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espresso_lite_v2.menu.vt.iram=IRAM espresso_lite_v2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espresso_lite_v2.menu.exception.legacy=Legacy (new can return nullptr) -espresso_lite_v2.menu.exception.legacy.build.exception_flags=-fno-exceptions -espresso_lite_v2.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -espresso_lite_v2.menu.exception.disabled=Disabled (new can abort) +espresso_lite_v2.menu.exception.disabled=Disabled (new aborts on oom) espresso_lite_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT espresso_lite_v2.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espresso_lite_v2.menu.exception.enabled=Enabled @@ -2007,10 +1983,7 @@ phoenix_v1.menu.vt.heap=Heap phoenix_v1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM phoenix_v1.menu.vt.iram=IRAM phoenix_v1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -phoenix_v1.menu.exception.legacy=Legacy (new can return nullptr) -phoenix_v1.menu.exception.legacy.build.exception_flags=-fno-exceptions -phoenix_v1.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -phoenix_v1.menu.exception.disabled=Disabled (new can abort) +phoenix_v1.menu.exception.disabled=Disabled (new aborts on oom) phoenix_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT phoenix_v1.menu.exception.disabled.build.stdcpp_lib=-lstdc++ phoenix_v1.menu.exception.enabled=Enabled @@ -2200,10 +2173,7 @@ phoenix_v2.menu.vt.heap=Heap phoenix_v2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM phoenix_v2.menu.vt.iram=IRAM phoenix_v2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -phoenix_v2.menu.exception.legacy=Legacy (new can return nullptr) -phoenix_v2.menu.exception.legacy.build.exception_flags=-fno-exceptions -phoenix_v2.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -phoenix_v2.menu.exception.disabled=Disabled (new can abort) +phoenix_v2.menu.exception.disabled=Disabled (new aborts on oom) phoenix_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT phoenix_v2.menu.exception.disabled.build.stdcpp_lib=-lstdc++ phoenix_v2.menu.exception.enabled=Enabled @@ -2393,10 +2363,7 @@ nodemcu.menu.vt.heap=Heap nodemcu.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM nodemcu.menu.vt.iram=IRAM nodemcu.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -nodemcu.menu.exception.legacy=Legacy (new can return nullptr) -nodemcu.menu.exception.legacy.build.exception_flags=-fno-exceptions -nodemcu.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -nodemcu.menu.exception.disabled=Disabled (new can abort) +nodemcu.menu.exception.disabled=Disabled (new aborts on oom) nodemcu.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT nodemcu.menu.exception.disabled.build.stdcpp_lib=-lstdc++ nodemcu.menu.exception.enabled=Enabled @@ -2583,10 +2550,7 @@ nodemcuv2.menu.vt.heap=Heap nodemcuv2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM nodemcuv2.menu.vt.iram=IRAM nodemcuv2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -nodemcuv2.menu.exception.legacy=Legacy (new can return nullptr) -nodemcuv2.menu.exception.legacy.build.exception_flags=-fno-exceptions -nodemcuv2.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -nodemcuv2.menu.exception.disabled=Disabled (new can abort) +nodemcuv2.menu.exception.disabled=Disabled (new aborts on oom) nodemcuv2.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT nodemcuv2.menu.exception.disabled.build.stdcpp_lib=-lstdc++ nodemcuv2.menu.exception.enabled=Enabled @@ -2777,10 +2741,7 @@ modwifi.menu.vt.heap=Heap modwifi.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM modwifi.menu.vt.iram=IRAM modwifi.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -modwifi.menu.exception.legacy=Legacy (new can return nullptr) -modwifi.menu.exception.legacy.build.exception_flags=-fno-exceptions -modwifi.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -modwifi.menu.exception.disabled=Disabled (new can abort) +modwifi.menu.exception.disabled=Disabled (new aborts on oom) modwifi.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT modwifi.menu.exception.disabled.build.stdcpp_lib=-lstdc++ modwifi.menu.exception.enabled=Enabled @@ -2987,10 +2948,7 @@ thing.menu.vt.heap=Heap thing.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM thing.menu.vt.iram=IRAM thing.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -thing.menu.exception.legacy=Legacy (new can return nullptr) -thing.menu.exception.legacy.build.exception_flags=-fno-exceptions -thing.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -thing.menu.exception.disabled=Disabled (new can abort) +thing.menu.exception.disabled=Disabled (new aborts on oom) thing.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT thing.menu.exception.disabled.build.stdcpp_lib=-lstdc++ thing.menu.exception.enabled=Enabled @@ -3177,10 +3135,7 @@ thingdev.menu.vt.heap=Heap thingdev.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM thingdev.menu.vt.iram=IRAM thingdev.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -thingdev.menu.exception.legacy=Legacy (new can return nullptr) -thingdev.menu.exception.legacy.build.exception_flags=-fno-exceptions -thingdev.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -thingdev.menu.exception.disabled=Disabled (new can abort) +thingdev.menu.exception.disabled=Disabled (new aborts on oom) thingdev.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT thingdev.menu.exception.disabled.build.stdcpp_lib=-lstdc++ thingdev.menu.exception.enabled=Enabled @@ -3367,10 +3322,7 @@ blynk.menu.vt.heap=Heap blynk.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM blynk.menu.vt.iram=IRAM blynk.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -blynk.menu.exception.legacy=Legacy (new can return nullptr) -blynk.menu.exception.legacy.build.exception_flags=-fno-exceptions -blynk.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -blynk.menu.exception.disabled=Disabled (new can abort) +blynk.menu.exception.disabled=Disabled (new aborts on oom) blynk.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT blynk.menu.exception.disabled.build.stdcpp_lib=-lstdc++ blynk.menu.exception.enabled=Enabled @@ -3557,10 +3509,7 @@ esp210.menu.vt.heap=Heap esp210.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM esp210.menu.vt.iram=IRAM esp210.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -esp210.menu.exception.legacy=Legacy (new can return nullptr) -esp210.menu.exception.legacy.build.exception_flags=-fno-exceptions -esp210.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -esp210.menu.exception.disabled=Disabled (new can abort) +esp210.menu.exception.disabled=Disabled (new aborts on oom) esp210.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT esp210.menu.exception.disabled.build.stdcpp_lib=-lstdc++ esp210.menu.exception.enabled=Enabled @@ -3747,10 +3696,7 @@ d1_mini.menu.vt.heap=Heap d1_mini.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1_mini.menu.vt.iram=IRAM d1_mini.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1_mini.menu.exception.legacy=Legacy (new can return nullptr) -d1_mini.menu.exception.legacy.build.exception_flags=-fno-exceptions -d1_mini.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -d1_mini.menu.exception.disabled=Disabled (new can abort) +d1_mini.menu.exception.disabled=Disabled (new aborts on oom) d1_mini.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT d1_mini.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1_mini.menu.exception.enabled=Enabled @@ -3937,10 +3883,7 @@ d1_mini_pro.menu.vt.heap=Heap d1_mini_pro.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1_mini_pro.menu.vt.iram=IRAM d1_mini_pro.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1_mini_pro.menu.exception.legacy=Legacy (new can return nullptr) -d1_mini_pro.menu.exception.legacy.build.exception_flags=-fno-exceptions -d1_mini_pro.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -d1_mini_pro.menu.exception.disabled=Disabled (new can abort) +d1_mini_pro.menu.exception.disabled=Disabled (new aborts on oom) d1_mini_pro.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT d1_mini_pro.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1_mini_pro.menu.exception.enabled=Enabled @@ -4110,10 +4053,7 @@ d1_mini_lite.menu.vt.heap=Heap d1_mini_lite.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1_mini_lite.menu.vt.iram=IRAM d1_mini_lite.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1_mini_lite.menu.exception.legacy=Legacy (new can return nullptr) -d1_mini_lite.menu.exception.legacy.build.exception_flags=-fno-exceptions -d1_mini_lite.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -d1_mini_lite.menu.exception.disabled=Disabled (new can abort) +d1_mini_lite.menu.exception.disabled=Disabled (new aborts on oom) d1_mini_lite.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT d1_mini_lite.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1_mini_lite.menu.exception.enabled=Enabled @@ -4340,10 +4280,7 @@ d1.menu.vt.heap=Heap d1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1.menu.vt.iram=IRAM d1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1.menu.exception.legacy=Legacy (new can return nullptr) -d1.menu.exception.legacy.build.exception_flags=-fno-exceptions -d1.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -d1.menu.exception.disabled=Disabled (new can abort) +d1.menu.exception.disabled=Disabled (new aborts on oom) d1.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT d1.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1.menu.exception.enabled=Enabled @@ -4530,10 +4467,7 @@ espino.menu.vt.heap=Heap espino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espino.menu.vt.iram=IRAM espino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espino.menu.exception.legacy=Legacy (new can return nullptr) -espino.menu.exception.legacy.build.exception_flags=-fno-exceptions -espino.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -espino.menu.exception.disabled=Disabled (new can abort) +espino.menu.exception.disabled=Disabled (new aborts on oom) espino.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT espino.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espino.menu.exception.enabled=Enabled @@ -4723,10 +4657,7 @@ espinotee.menu.vt.heap=Heap espinotee.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espinotee.menu.vt.iram=IRAM espinotee.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espinotee.menu.exception.legacy=Legacy (new can return nullptr) -espinotee.menu.exception.legacy.build.exception_flags=-fno-exceptions -espinotee.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -espinotee.menu.exception.disabled=Disabled (new can abort) +espinotee.menu.exception.disabled=Disabled (new aborts on oom) espinotee.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT espinotee.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espinotee.menu.exception.enabled=Enabled @@ -4930,10 +4861,7 @@ wifinfo.menu.vt.heap=Heap wifinfo.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wifinfo.menu.vt.iram=IRAM wifinfo.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wifinfo.menu.exception.legacy=Legacy (new can return nullptr) -wifinfo.menu.exception.legacy.build.exception_flags=-fno-exceptions -wifinfo.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -wifinfo.menu.exception.disabled=Disabled (new can abort) +wifinfo.menu.exception.disabled=Disabled (new aborts on oom) wifinfo.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT wifinfo.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wifinfo.menu.exception.enabled=Enabled @@ -5179,10 +5107,7 @@ arduino-esp8266.menu.vt.heap=Heap arduino-esp8266.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM arduino-esp8266.menu.vt.iram=IRAM arduino-esp8266.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -arduino-esp8266.menu.exception.legacy=Legacy (new can return nullptr) -arduino-esp8266.menu.exception.legacy.build.exception_flags=-fno-exceptions -arduino-esp8266.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -arduino-esp8266.menu.exception.disabled=Disabled (new can abort) +arduino-esp8266.menu.exception.disabled=Disabled (new aborts on oom) arduino-esp8266.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT arduino-esp8266.menu.exception.disabled.build.stdcpp_lib=-lstdc++ arduino-esp8266.menu.exception.enabled=Enabled @@ -5370,10 +5295,7 @@ gen4iod.menu.vt.heap=Heap gen4iod.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM gen4iod.menu.vt.iram=IRAM gen4iod.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -gen4iod.menu.exception.legacy=Legacy (new can return nullptr) -gen4iod.menu.exception.legacy.build.exception_flags=-fno-exceptions -gen4iod.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -gen4iod.menu.exception.disabled=Disabled (new can abort) +gen4iod.menu.exception.disabled=Disabled (new aborts on oom) gen4iod.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT gen4iod.menu.exception.disabled.build.stdcpp_lib=-lstdc++ gen4iod.menu.exception.enabled=Enabled @@ -5628,10 +5550,7 @@ oak.menu.vt.heap=Heap oak.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM oak.menu.vt.iram=IRAM oak.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -oak.menu.exception.legacy=Legacy (new can return nullptr) -oak.menu.exception.legacy.build.exception_flags=-fno-exceptions -oak.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -oak.menu.exception.disabled=Disabled (new can abort) +oak.menu.exception.disabled=Disabled (new aborts on oom) oak.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT oak.menu.exception.disabled.build.stdcpp_lib=-lstdc++ oak.menu.exception.enabled=Enabled @@ -5818,10 +5737,7 @@ wifiduino.menu.vt.heap=Heap wifiduino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wifiduino.menu.vt.iram=IRAM wifiduino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wifiduino.menu.exception.legacy=Legacy (new can return nullptr) -wifiduino.menu.exception.legacy.build.exception_flags=-fno-exceptions -wifiduino.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -wifiduino.menu.exception.disabled=Disabled (new can abort) +wifiduino.menu.exception.disabled=Disabled (new aborts on oom) wifiduino.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT wifiduino.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wifiduino.menu.exception.enabled=Enabled @@ -6008,10 +5924,7 @@ wifi_slot.menu.vt.heap=Heap wifi_slot.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wifi_slot.menu.vt.iram=IRAM wifi_slot.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wifi_slot.menu.exception.legacy=Legacy (new can return nullptr) -wifi_slot.menu.exception.legacy.build.exception_flags=-fno-exceptions -wifi_slot.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -wifi_slot.menu.exception.disabled=Disabled (new can abort) +wifi_slot.menu.exception.disabled=Disabled (new aborts on oom) wifi_slot.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT wifi_slot.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wifi_slot.menu.exception.enabled=Enabled @@ -6312,10 +6225,7 @@ wiolink.menu.vt.heap=Heap wiolink.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wiolink.menu.vt.iram=IRAM wiolink.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wiolink.menu.exception.legacy=Legacy (new can return nullptr) -wiolink.menu.exception.legacy.build.exception_flags=-fno-exceptions -wiolink.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -wiolink.menu.exception.disabled=Disabled (new can abort) +wiolink.menu.exception.disabled=Disabled (new aborts on oom) wiolink.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT wiolink.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wiolink.menu.exception.enabled=Enabled @@ -6502,10 +6412,7 @@ espectro.menu.vt.heap=Heap espectro.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espectro.menu.vt.iram=IRAM espectro.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espectro.menu.exception.legacy=Legacy (new can return nullptr) -espectro.menu.exception.legacy.build.exception_flags=-fno-exceptions -espectro.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -espectro.menu.exception.disabled=Disabled (new can abort) +espectro.menu.exception.disabled=Disabled (new aborts on oom) espectro.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT espectro.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espectro.menu.exception.enabled=Enabled @@ -6692,10 +6599,7 @@ eduinowifi.menu.vt.heap=Heap eduinowifi.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM eduinowifi.menu.vt.iram=IRAM eduinowifi.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -eduinowifi.menu.exception.legacy=Legacy (new can return nullptr) -eduinowifi.menu.exception.legacy.build.exception_flags=-fno-exceptions -eduinowifi.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -eduinowifi.menu.exception.disabled=Disabled (new can abort) +eduinowifi.menu.exception.disabled=Disabled (new aborts on oom) eduinowifi.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT eduinowifi.menu.exception.disabled.build.stdcpp_lib=-lstdc++ eduinowifi.menu.exception.enabled=Enabled @@ -6892,10 +6796,7 @@ sonoff.menu.vt.heap=Heap sonoff.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM sonoff.menu.vt.iram=IRAM sonoff.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -sonoff.menu.exception.legacy=Legacy (new can return nullptr) -sonoff.menu.exception.legacy.build.exception_flags=-fno-exceptions -sonoff.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -sonoff.menu.exception.disabled=Disabled (new can abort) +sonoff.menu.exception.disabled=Disabled (new aborts on oom) sonoff.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT sonoff.menu.exception.disabled.build.stdcpp_lib=-lstdc++ sonoff.menu.exception.enabled=Enabled @@ -7123,10 +7024,7 @@ espmxdevkit.menu.vt.heap=Heap espmxdevkit.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espmxdevkit.menu.vt.iram=IRAM espmxdevkit.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espmxdevkit.menu.exception.legacy=Legacy (new can return nullptr) -espmxdevkit.menu.exception.legacy.build.exception_flags=-fno-exceptions -espmxdevkit.menu.exception.legacy.build.stdcpp_lib=-lstdc++ -espmxdevkit.menu.exception.disabled=Disabled (new can abort) +espmxdevkit.menu.exception.disabled=Disabled (new aborts on oom) espmxdevkit.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT espmxdevkit.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espmxdevkit.menu.exception.enabled=Enabled diff --git a/cores/esp8266/FunctionalInterrupt.cpp b/cores/esp8266/FunctionalInterrupt.cpp index f35b315e98..665d8043b3 100644 --- a/cores/esp8266/FunctionalInterrupt.cpp +++ b/cores/esp8266/FunctionalInterrupt.cpp @@ -7,7 +7,7 @@ typedef void (*voidFuncPtr)(void); typedef void (*voidFuncPtrArg)(void*); // Helper functions for Functional interrupt routines -extern "C" bool __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtr userFunc, void*fp, int mode, bool functional); +extern "C" void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtr userFunc, void*fp, int mode, bool functional); void ICACHE_RAM_ATTR interruptFunctional(void* arg) @@ -34,52 +34,32 @@ extern "C" } } -bool attachInterrupt(uint8_t pin, std::function intRoutine, int mode) +void attachInterrupt(uint8_t pin, std::function intRoutine, int mode) { // use the local interrupt routine which takes the ArgStructure as argument InterruptInfo* ii = nullptr; - FunctionInfo* fi = new (std::nothrow) FunctionInfo; - if (fi == nullptr) - return false; + FunctionInfo* fi = new FunctionInfo; fi->reqFunction = intRoutine; - ArgStructure* as = new (std::nothrow) ArgStructure; - if (as == nullptr) - { - delete(fi); - return false; - } + ArgStructure* as = new ArgStructure; as->interruptInfo = ii; as->functionInfo = fi; - return __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); + __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); } -bool attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode) +void attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode) { - InterruptInfo* ii = new (std::nothrow) InterruptInfo; - if (ii == nullptr) - return false; + InterruptInfo* ii = new InterruptInfo; FunctionInfo* fi = new FunctionInfo; - if (fi == nullptr) - { - delete ii; - return false; - } fi->reqScheduledFunction = scheduledIntRoutine; - ArgStructure* as = new (std::nothrow) ArgStructure; - if (as == nullptr) - { - delete ii; - delete fi; - return false; - } + ArgStructure* as = new ArgStructure; as->interruptInfo = ii; as->functionInfo = fi; - return __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); + __attachInterruptFunctionalArg(pin, (voidFuncPtr)interruptFunctional, as, mode, true); } diff --git a/cores/esp8266/FunctionalInterrupt.h b/cores/esp8266/FunctionalInterrupt.h index 29f49542c3..968793e499 100644 --- a/cores/esp8266/FunctionalInterrupt.h +++ b/cores/esp8266/FunctionalInterrupt.h @@ -28,8 +28,8 @@ struct ArgStructure { FunctionInfo* functionInfo = nullptr; }; -bool attachInterrupt(uint8_t pin, std::function intRoutine, int mode); -bool attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode); +void attachInterrupt(uint8_t pin, std::function intRoutine, int mode); +void attachScheduledInterrupt(uint8_t pin, std::function scheduledIntRoutine, int mode); #endif //INTERRUPTS_H diff --git a/cores/esp8266/Updater.cpp b/cores/esp8266/Updater.cpp index 3b9532021d..e5224e3814 100644 --- a/cores/esp8266/Updater.cpp +++ b/cores/esp8266/Updater.cpp @@ -182,7 +182,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) { } else { _bufferSize = 256; } - _buffer = new (std::nothrow) uint8_t[_bufferSize]; + _buffer = new uint8_t[_bufferSize]; _command = command; #ifdef DEBUG_UPDATER diff --git a/libraries/ArduinoOTA/ArduinoOTA.cpp b/libraries/ArduinoOTA/ArduinoOTA.cpp index 30f9c413e1..64e8397a2a 100644 --- a/libraries/ArduinoOTA/ArduinoOTA.cpp +++ b/libraries/ArduinoOTA/ArduinoOTA.cpp @@ -106,9 +106,9 @@ void ArduinoOTAClass::setRebootOnSuccess(bool reboot){ _rebootOnSuccess = reboot; } -bool ArduinoOTAClass::begin(bool useMDNS) { +void ArduinoOTAClass::begin(bool useMDNS) { if (_initialized) - return true; + return; _useMDNS = useMDNS; @@ -126,13 +126,11 @@ bool ArduinoOTAClass::begin(bool useMDNS) { _udp_ota = 0; } - _udp_ota = new (std::nothrow) UdpContext; - if (_udp_ota == nullptr) - return false; + _udp_ota = new UdpContext; _udp_ota->ref(); if(!_udp_ota->listen(IP_ADDR_ANY, _port)) - return false; + return; _udp_ota->onRx(std::bind(&ArduinoOTAClass::_onRx, this)); #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS) @@ -151,7 +149,6 @@ bool ArduinoOTAClass::begin(bool useMDNS) { #ifdef OTA_DEBUG OTA_DEBUG.printf("OTA server at: %s.local:%u\n", _hostname.c_str(), _port); #endif - return true; } int ArduinoOTAClass::parseInt(){ diff --git a/libraries/ArduinoOTA/ArduinoOTA.h b/libraries/ArduinoOTA/ArduinoOTA.h index 5a84fed230..1dfcaeed38 100644 --- a/libraries/ArduinoOTA/ArduinoOTA.h +++ b/libraries/ArduinoOTA/ArduinoOTA.h @@ -60,7 +60,7 @@ class ArduinoOTAClass void onProgress(THandlerFunction_Progress fn); //Starts the ArduinoOTA service - bool begin(bool useMDNS = true); + void begin(bool useMDNS = true); //Call this in loop() to run the service. Also calls MDNS.update() when begin() or begin(true) is used. void handle(); diff --git a/libraries/EEPROM/EEPROM.cpp b/libraries/EEPROM/EEPROM.cpp index c0cedb8350..90bbf8ca52 100644 --- a/libraries/EEPROM/EEPROM.cpp +++ b/libraries/EEPROM/EEPROM.cpp @@ -64,12 +64,9 @@ void EEPROMClass::begin(size_t size) { //In case begin() is called a 2nd+ time, don't reallocate if size is the same if(_data && size != _size) { delete[] _data; - _data = new (std::nothrow) uint8_t[size]; + _data = new uint8_t[size]; } else if(!_data) { - _data = new (std::nothrow) uint8_t[size]; - } - if (_data == nullptr) { - return; + _data = new uint8_t[size]; } _size = size; diff --git a/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino b/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino index 7940ec7f88..2d6f49592b 100644 --- a/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino +++ b/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino @@ -41,10 +41,7 @@ void loop() { // wait for WiFi connection if ((WiFiMulti.run() == WL_CONNECTED)) { - std::unique_ptrclient(new (std::nothrow) BearSSL::WiFiClientSecure); - if (client == nullptr) { - return; - } + std::unique_ptrclient(new BearSSL::WiFiClientSecure); client->setFingerprint(fingerprint); diff --git a/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino b/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino index 9d92b0c830..a69b9e35c6 100644 --- a/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino +++ b/libraries/ESP8266HTTPClient/examples/StreamHttpsClient/StreamHttpsClient.ino @@ -38,10 +38,7 @@ void loop() { // wait for WiFi connection if ((WiFiMulti.run() == WL_CONNECTED)) { - std::unique_ptr client(new (std::nothrow) BearSSL::WiFiClientSecure); - if (client == nullptr) { - return; - } + std::unique_ptr client(new BearSSL::WiFiClientSecure); bool mfln = client->probeMaxFragmentLength("tls.mbed.org", 443, 1024); Serial.printf("\nConnecting to https://tls.mbed.org\n"); diff --git a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp index 84770ee5c1..580964da13 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp @@ -37,7 +37,7 @@ class TransportTraits virtual std::unique_ptr create() { - return std::unique_ptr(new (std::nothrow) WiFiClient()); + return std::unique_ptr(new WiFiClient()); } virtual bool verify(WiFiClient& client, const char* host) @@ -59,9 +59,8 @@ class BearSSLTraits : public TransportTraits std::unique_ptr create() override { - BearSSL::WiFiClientSecure *client = new (std::nothrow) BearSSL::WiFiClientSecure(); - if (client != nullptr) - client->setFingerprint(_fingerprint); + BearSSL::WiFiClientSecure *client = new BearSSL::WiFiClientSecure(); + client->setFingerprint(_fingerprint); return std::unique_ptr(client); } @@ -213,8 +212,8 @@ bool HTTPClient::begin(String url) if (!beginInternal(url, "http")) { return false; } - _transportTraits = TransportTraitsPtr(new (std::nothrow) TransportTraits()); - return _transportTraits != nullptr; + _transportTraits = TransportTraitsPtr(new TransportTraits()); + return true; } @@ -291,9 +290,9 @@ bool HTTPClient::begin(String host, uint16_t port, String uri) _host = host; _port = port; _uri = uri; - _transportTraits = TransportTraitsPtr(new (std::nothrow) TransportTraits()); + _transportTraits = TransportTraitsPtr(new TransportTraits()); DEBUG_HTTPCLIENT("[HTTP-Client][begin] host: %s port: %d uri: %s\n", host.c_str(), port, uri.c_str()); - return _transportTraits != nullptr; + return true; } @@ -310,13 +309,13 @@ bool HTTPClient::begin(String host, uint16_t port, String uri, const uint8_t htt _port = port; _uri = uri; - _transportTraits = TransportTraitsPtr(new (std::nothrow) BearSSLTraits(httpsFingerprint)); + _transportTraits = TransportTraitsPtr(new BearSSLTraits(httpsFingerprint)); DEBUG_HTTPCLIENT("[HTTP-Client][begin] host: %s port: %d url: %s BearSSL-httpsFingerprint:", host.c_str(), port, uri.c_str()); for (size_t i=0; i < 20; i++) { DEBUG_HTTPCLIENT(" %02x", httpsFingerprint[i]); } DEBUG_HTTPCLIENT("\n"); - return _transportTraits != nullptr; + return true; } diff --git a/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino b/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino index dd19e56238..a2514e171d 100644 --- a/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino +++ b/libraries/ESP8266HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino @@ -106,7 +106,7 @@ void setup() MDNS.begin(host); - httpServer.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey)); + httpServer.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey)); httpUpdater.setup(&httpServer, update_path, update_username, update_password); httpServer.begin(); diff --git a/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp b/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp index f693670338..ac8582c579 100644 --- a/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp +++ b/libraries/ESP8266LLMNR/ESP8266LLMNR.cpp @@ -116,9 +116,7 @@ bool LLMNRResponder::_restart() { if (igmp_joingroup(IP4_ADDR_ANY4, llmnr) != ERR_OK) return false; - _conn = new (std::nothrow) UdpContext; - if (!_conn) - return false; + _conn = new UdpContext; _conn->ref(); if (!_conn->listen(IP_ADDR_ANY, LLMNR_PORT)) diff --git a/libraries/ESP8266SSDP/ESP8266SSDP.cpp b/libraries/ESP8266SSDP/ESP8266SSDP.cpp index e0b5a5d647..93121ffc8c 100644 --- a/libraries/ESP8266SSDP/ESP8266SSDP.cpp +++ b/libraries/ESP8266SSDP/ESP8266SSDP.cpp @@ -175,10 +175,7 @@ bool SSDPClass::begin() { assert(NULL == _server); - _server = new (std::nothrow) UdpContext; - if (_server == nullptr) { - return false; - } + _server = new UdpContext; _server->ref(); IPAddress local = WiFi.localIP(); @@ -511,9 +508,7 @@ void SSDPClass::_onTimerStatic(SSDPClass* self) { void SSDPClass::_startTimer() { _stopTimer(); - _timer = new (std::nothrow) SSDPTimer(); - if (_timer == nullptr) - return; + _timer = new SSDPTimer(); ETSTimer* tm = &(_timer->timer); const int interval = 1000; os_timer_disarm(tm); diff --git a/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino b/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino index c6c0d5563c..4b786dc1a5 100644 --- a/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino +++ b/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino @@ -128,7 +128,7 @@ void setup(void){ Serial.println("MDNS responder started"); } - server.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey)); + server.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey)); server.on("/", handleRoot); diff --git a/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino b/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino index 0671b122ed..c2ceaca53d 100644 --- a/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino +++ b/libraries/ESP8266WebServer/examples/HttpHashCredAuth/HttpHashCredAuth.ino @@ -111,7 +111,7 @@ void setup() { ESP.restart(); } - server.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey)); + server.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey)); server.on("/",showcredentialpage); //for this simple example, just show a simple page for changing credentials at the root server.on("/" + change_creds,handlecredentialchange); //handles submission of credentials from the client server.onNotFound(redirect); diff --git a/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h b/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h index b85899610b..a686c43468 100644 --- a/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h +++ b/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h @@ -266,7 +266,7 @@ void ESP8266WebServerTemplate::on(const Uri &uri, HTTPMethod method, template void ESP8266WebServerTemplate::on(const Uri &uri, HTTPMethod method, ESP8266WebServerTemplate::THandlerFunction fn, ESP8266WebServerTemplate::THandlerFunction ufn) { - _addRequestHandler(new (std::nothrow) FunctionRequestHandler(fn, ufn, uri, method)); + _addRequestHandler(new FunctionRequestHandler(fn, ufn, uri, method)); } template @@ -288,7 +288,7 @@ void ESP8266WebServerTemplate::_addRequestHandler(RequestHandlerType template void ESP8266WebServerTemplate::serveStatic(const char* uri, FS& fs, const char* path, const char* cache_header) { - _addRequestHandler(new (std::nothrow) StaticRequestHandler(fs, path, uri, cache_header)); + _addRequestHandler(new StaticRequestHandler(fs, path, uri, cache_header)); } template @@ -645,9 +645,7 @@ void ESP8266WebServerTemplate::collectHeaders(const char* headerKeys _headerKeysCount = headerKeysCount + 1; if (_currentHeaders) delete[]_currentHeaders; - _currentHeaders = new (std::nothrow) RequestArgument[_headerKeysCount]; - if (_currentHeaders == nullptr) - return; + _currentHeaders = new RequestArgument[_headerKeysCount]; _currentHeaders[0].key = FPSTR(AUTHORIZATION_HEADER); for (int i = 1; i < _headerKeysCount; i++){ _currentHeaders[i].key = headerKeys[i-1]; diff --git a/libraries/ESP8266WebServer/src/Parsing-impl.h b/libraries/ESP8266WebServer/src/Parsing-impl.h index 3eb170b448..4bb6db8878 100644 --- a/libraries/ESP8266WebServer/src/Parsing-impl.h +++ b/libraries/ESP8266WebServer/src/Parsing-impl.h @@ -283,9 +283,7 @@ void ESP8266WebServerTemplate::_parseArguments(const String& data) { _currentArgCount = _parseArgumentsPrivate(data, nullArgHandler()); // allocate one more, this is needed because {"plain": plainBuf} is always added - _currentArgs = new (std::nothrow) RequestArgument[_currentArgCount + 1]; - if (_currentArgs == nullptr) - return; + _currentArgs = new RequestArgument[_currentArgCount + 1]; (void)_parseArgumentsPrivate(data, storeArgHandler()); } @@ -372,11 +370,7 @@ bool ESP8266WebServerTemplate::_parseForm(ClientType& client, const //start reading the form if (line == ("--"+boundary)){ if(_postArgs) delete[] _postArgs; - _postArgs = new (std::nothrow) RequestArgument[WEBSERVER_MAX_POST_ARGS]; - if (_postArgs == nullptr) { - DBGWS("Parse form: oom\n"); - return false; - } + _postArgs = new RequestArgument[WEBSERVER_MAX_POST_ARGS]; _postArgsLen = 0; while(1){ String argName; @@ -434,11 +428,7 @@ bool ESP8266WebServerTemplate::_parseForm(ClientType& client, const break; } } else { - _currentUpload.reset(new (std::nothrow) HTTPUpload()); - if (_currentUpload == nullptr) { - DBGWS("Parse form: oom\n"); - return false; - } + _currentUpload.reset(new HTTPUpload()); _currentUpload->status = UPLOAD_FILE_START; _currentUpload->name = argName; _currentUpload->filename = argFilename; @@ -531,9 +521,7 @@ bool ESP8266WebServerTemplate::_parseForm(ClientType& client, const arg.value = _currentArgs[iarg].value; } if (_currentArgs) delete[] _currentArgs; - _currentArgs = new (std::nothrow) RequestArgument[_postArgsLen]; - if (_currentArgs == nullptr) - return false; + _currentArgs = new RequestArgument[_postArgsLen]; for (iarg = 0; iarg < _postArgsLen; iarg++){ RequestArgument& arg = _currentArgs[iarg]; arg.key = _postArgs[iarg].key; diff --git a/libraries/ESP8266WebServer/src/Uri.h b/libraries/ESP8266WebServer/src/Uri.h index 6b0fa998b8..95f5c89360 100644 --- a/libraries/ESP8266WebServer/src/Uri.h +++ b/libraries/ESP8266WebServer/src/Uri.h @@ -16,7 +16,7 @@ class Uri { virtual ~Uri() {} virtual Uri* clone() const { - return new (std::nothrow) Uri(_uri); + return new Uri(_uri); }; virtual bool canHandle(const String &requestUri, __attribute__((unused)) std::vector &pathArgs) { diff --git a/libraries/ESP8266WebServer/src/uri/UriBraces.h b/libraries/ESP8266WebServer/src/uri/UriBraces.h index fa32d6be99..29652efc7f 100644 --- a/libraries/ESP8266WebServer/src/uri/UriBraces.h +++ b/libraries/ESP8266WebServer/src/uri/UriBraces.h @@ -10,7 +10,7 @@ class UriBraces : public Uri { explicit UriBraces(const String &uri) : Uri(uri) {}; Uri* clone() const override final { - return new (std::nothrow) UriBraces(_uri); + return new UriBraces(_uri); }; bool canHandle(const String &requestUri, std::vector &pathArgs) override final { diff --git a/libraries/ESP8266WebServer/src/uri/UriGlob.h b/libraries/ESP8266WebServer/src/uri/UriGlob.h index 8cab6e6bc9..1e222cbabd 100644 --- a/libraries/ESP8266WebServer/src/uri/UriGlob.h +++ b/libraries/ESP8266WebServer/src/uri/UriGlob.h @@ -11,7 +11,7 @@ class UriGlob : public Uri { explicit UriGlob(const String &uri) : Uri(uri) {}; Uri* clone() const override final { - return new (std::nothrow) UriGlob(_uri); + return new UriGlob(_uri); }; bool canHandle(const String &requestUri, __attribute__((unused)) std::vector &pathArgs) override final { diff --git a/libraries/ESP8266WebServer/src/uri/UriRegex.h b/libraries/ESP8266WebServer/src/uri/UriRegex.h index 47128eb3a0..eef1b516d4 100644 --- a/libraries/ESP8266WebServer/src/uri/UriRegex.h +++ b/libraries/ESP8266WebServer/src/uri/UriRegex.h @@ -25,7 +25,7 @@ class UriRegex : public Uri { } Uri* clone() const override final { - return new (std::nothrow) UriRegex(_uri); + return new UriRegex(_uri); }; bool canHandle(const String &requestUri, std::vector &pathArgs) override final { diff --git a/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino b/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino index fac012404e..a599a0395a 100644 --- a/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino +++ b/libraries/ESP8266WiFi/examples/BearSSL_CertStore/BearSSL_CertStore.ino @@ -145,7 +145,7 @@ void setup() { return; // Can't connect to anything w/o certs! } - BearSSL::WiFiClientSecure *bear = new (std::nothrow) BearSSL::WiFiClientSecure(); + BearSSL::WiFiClientSecure *bear = new BearSSL::WiFiClientSecure(); // Integrate the cert store with this connection bear->setCertStore(&certStore); Serial.printf("Attempting to fetch https://github.com/...\n"); @@ -164,7 +164,7 @@ void loop() { site.replace(String("\n"), emptyString); Serial.printf("https://%s/\n", site.c_str()); - BearSSL::WiFiClientSecure *bear = new (std::nothrow) BearSSL::WiFiClientSecure(); + BearSSL::WiFiClientSecure *bear = new BearSSL::WiFiClientSecure(); // Integrate the cert store with this connection bear->setCertStore(&certStore); fetchURL(bear, site.c_str(), 443, "/"); diff --git a/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino b/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino index 24249ffb52..d27382284d 100644 --- a/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino +++ b/libraries/ESP8266WiFi/examples/BearSSL_Server/BearSSL_Server.ino @@ -161,8 +161,8 @@ void setup() { Serial.println(WiFi.localIP()); // Attach the server private cert/key combo - BearSSL::X509List *serverCertList = new (std::nothrow) BearSSL::X509List(server_cert); - BearSSL::PrivateKey *serverPrivKey = new (std::nothrow) BearSSL::PrivateKey(server_private_key); + BearSSL::X509List *serverCertList = new BearSSL::X509List(server_cert); + BearSSL::PrivateKey *serverPrivKey = new BearSSL::PrivateKey(server_private_key); #ifndef USE_EC server.setRSACert(serverCertList, serverPrivKey); #else diff --git a/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino b/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino index 48dc6aba9b..a50f115283 100644 --- a/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino +++ b/libraries/ESP8266WiFi/examples/BearSSL_ServerClientCert/BearSSL_ServerClientCert.ino @@ -202,12 +202,12 @@ void setup() { setClock(); // Required for X.509 validation // Attach the server private cert/key combo - BearSSL::X509List *serverCertList = new (std::nothrow) BearSSL::X509List(server_cert); - BearSSL::PrivateKey *serverPrivKey = new (std::nothrow) BearSSL::PrivateKey(server_private_key); + BearSSL::X509List *serverCertList = new BearSSL::X509List(server_cert); + BearSSL::PrivateKey *serverPrivKey = new BearSSL::PrivateKey(server_private_key); server.setRSACert(serverCertList, serverPrivKey); // Require a certificate validated by the trusted CA - BearSSL::X509List *serverTrustedCA = new (std::nothrow) BearSSL::X509List(ca_cert); + BearSSL::X509List *serverTrustedCA = new BearSSL::X509List(ca_cert); server.setClientTrustAnchor(serverTrustedCA); // Actually start accepting connections diff --git a/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino b/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino index bf547665e6..9102af12d8 100644 --- a/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino +++ b/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino @@ -85,7 +85,7 @@ void setup() { Serial.swap(); // Hardware serial is now on RX:GPIO13 TX:GPIO15 // use SoftwareSerial on regular RX(3)/TX(1) for logging - logger = new (std::nothrow) SoftwareSerial(3, 1); + logger = new SoftwareSerial(3, 1); logger->begin(BAUD_LOGGER); logger->enableIntTx(false); logger->println("\n\nUsing SoftwareSerial for logging"); diff --git a/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp b/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp index 6ffcca08da..b3d1b60c20 100644 --- a/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp +++ b/libraries/ESP8266WiFi/src/BearSSLHelpers.cpp @@ -109,7 +109,7 @@ namespace brssl { } static bool certificate_to_trust_anchor_inner(br_x509_trust_anchor *ta, const br_x509_certificate *xc) { - std::unique_ptr dc(new (std::nothrow) br_x509_decoder_context); // auto-delete on exit + std::unique_ptr dc(new br_x509_decoder_context); // auto-delete on exit std::vector vdn; br_x509_pkey *pk; @@ -244,7 +244,7 @@ namespace brssl { // blobs may be returned. pem_object *decode_pem(const void *src, size_t len, size_t *num) { std::vector pem_list; - std::unique_ptr pc(new (std::nothrow) br_pem_decoder_context); // auto-delete on exit + std::unique_ptr pc(new br_pem_decoder_context); // auto-delete on exit if (!pc.get()) { return nullptr; } @@ -405,7 +405,7 @@ namespace brssl { } static public_key *decode_public_key(const unsigned char *buff, size_t len) { - std::unique_ptr dc(new (std::nothrow) br_pkey_decoder_context); // auto-delete on exit + std::unique_ptr dc(new br_pkey_decoder_context); // auto-delete on exit if (!dc.get()) { return nullptr; } @@ -477,7 +477,7 @@ namespace brssl { } static private_key *decode_private_key(const unsigned char *buff, size_t len) { - std::unique_ptr dc(new (std::nothrow) br_skey_decoder_context); // auto-delete on exit + std::unique_ptr dc(new br_skey_decoder_context); // auto-delete on exit if (!dc.get()) { return nullptr; } diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp index 0eb5889836..65878a3d5b 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp @@ -308,10 +308,7 @@ void ESP8266WiFiScanClass::_scanDone(void* result, int status) { if(i == 0) { ESP8266WiFiScanClass::_scanResult = 0; } else { - bss_info* copied_info = new (std::nothrow) bss_info[i]; - if (copied_info == nullptr) { - return; - } + bss_info* copied_info = new bss_info[i]; i = 0; for(bss_info* it = head; it; it = STAILQ_NEXT(it, next), ++i) { memcpy(copied_info + i, it, sizeof(bss_info)); diff --git a/libraries/ESP8266WiFi/src/WiFiClient.cpp b/libraries/ESP8266WiFi/src/WiFiClient.cpp index 136016b07e..1663a29ecb 100644 --- a/libraries/ESP8266WiFi/src/WiFiClient.cpp +++ b/libraries/ESP8266WiFi/src/WiFiClient.cpp @@ -153,10 +153,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) pcb->local_port = _localPort++; } - _client = new (std::nothrow) ClientContext(pcb, nullptr, nullptr); - if (_client == nullptr) { - return 0; - } + _client = new ClientContext(pcb, nullptr, nullptr); _client->ref(); _client->setTimeout(_timeout); int res = _client->connect(ip, port); diff --git a/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp b/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp index 281612f7eb..2aa177b643 100644 --- a/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp +++ b/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp @@ -1580,21 +1580,21 @@ bool WiFiClientSecure::probeMaxFragmentLength(IPAddress ip, uint16_t port, uint1 // AXTLS compatibility interfaces bool WiFiClientSecure::setCACert(const uint8_t* pk, size_t size) { _axtls_ta = nullptr; - _axtls_ta = std::shared_ptr(new (std::nothrow) X509List(pk, size)); + _axtls_ta = std::shared_ptr(new X509List(pk, size)); _ta = _axtls_ta.get(); return _ta ? true : false; } bool WiFiClientSecure::setCertificate(const uint8_t* pk, size_t size) { _axtls_chain = nullptr; - _axtls_chain = std::shared_ptr(new (std::nothrow) X509List(pk, size)); + _axtls_chain = std::shared_ptr(new X509List(pk, size)); _chain = _axtls_chain.get(); return _chain ? true : false; } bool WiFiClientSecure::setPrivateKey(const uint8_t* pk, size_t size) { _axtls_sk = nullptr; - _axtls_sk = std::shared_ptr(new (std::nothrow) PrivateKey(pk, size)); + _axtls_sk = std::shared_ptr(new PrivateKey(pk, size)); _sk = _axtls_sk.get(); return _sk ? true : false; diff --git a/libraries/ESP8266WiFi/src/WiFiServer.cpp b/libraries/ESP8266WiFi/src/WiFiServer.cpp index 1ec78fed7f..2ee09f85fe 100644 --- a/libraries/ESP8266WiFi/src/WiFiServer.cpp +++ b/libraries/ESP8266WiFi/src/WiFiServer.cpp @@ -186,10 +186,7 @@ long WiFiServer::_accept(tcp_pcb* apcb, long err) { // always accept new PCB so incoming data can be stored in our buffers even before // user calls ::available() - ClientContext* client = new (std::nothrow) ClientContext(apcb, &WiFiServer::_s_discard, this); - if (client == nullptr) { - return ERR_MEM; - } + ClientContext* client = new ClientContext(apcb, &WiFiServer::_s_discard, this); // backlog doc: // http://lwip.100.n7.nabble.com/Problem-re-opening-listening-pbc-tt32484.html#a32494 diff --git a/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp b/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp index b4cb0e0e9c..087c90b4e8 100644 --- a/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp +++ b/libraries/ESP8266WiFi/src/WiFiServerSecureBearSSL.cpp @@ -107,8 +107,8 @@ WiFiClientSecure WiFiServerSecure::available(uint8_t* status) { void WiFiServerSecure::setServerKeyAndCert(const uint8_t *key, int keyLen, const uint8_t *cert, int certLen) { _axtls_chain = nullptr; _axtls_sk = nullptr; - _axtls_chain = std::shared_ptr(new (std::nothrow) X509List(cert, certLen)); - _axtls_sk = std::shared_ptr(new (std::nothrow) PrivateKey(key, keyLen)); + _axtls_chain = std::shared_ptr(new X509List(cert, certLen)); + _axtls_sk = std::shared_ptr(new PrivateKey(key, keyLen)); setRSACert(_axtls_chain.get(), _axtls_sk.get()); } diff --git a/libraries/ESP8266WiFi/src/WiFiUdp.cpp b/libraries/ESP8266WiFi/src/WiFiUdp.cpp index 8bbcddb278..a0a5c1d4e4 100644 --- a/libraries/ESP8266WiFi/src/WiFiUdp.cpp +++ b/libraries/ESP8266WiFi/src/WiFiUdp.cpp @@ -80,10 +80,7 @@ uint8_t WiFiUDP::begin(uint16_t port) _ctx = 0; } - _ctx = new (std::nothrow) UdpContext; - if (_ctx == nullptr) { - return 0; - } + _ctx = new UdpContext; _ctx->ref(); return (_ctx->listen(IPAddress(), port)) ? 1 : 0; } @@ -99,10 +96,7 @@ uint8_t WiFiUDP::beginMulticast(IPAddress interfaceAddr, IPAddress multicast, ui return 0; } - _ctx = new (std::nothrow) UdpContext; - if (_ctx == nullptr) { - return 0; - } + _ctx = new UdpContext; _ctx->ref(); ip_addr_t addr = IPADDR4_INIT(INADDR_ANY); if (!_ctx->listen(&addr, port)) { @@ -153,10 +147,7 @@ int WiFiUDP::beginPacket(const char *host, uint16_t port) int WiFiUDP::beginPacket(IPAddress ip, uint16_t port) { if (!_ctx) { - _ctx = new (std::nothrow) UdpContext; - if (_ctx == nullptr) { - return 0; - } + _ctx = new UdpContext; _ctx->ref(); } return (_ctx->connect(ip, port)) ? 1 : 0; @@ -166,10 +157,7 @@ int WiFiUDP::beginPacketMulticast(IPAddress multicastAddress, uint16_t port, IPAddress interfaceAddress, int ttl) { if (!_ctx) { - _ctx = new (std::nothrow) UdpContext; - if (_ctx == nullptr) { - return 0; - } + _ctx = new UdpContext; _ctx->ref(); } if (!_ctx->connect(multicastAddress, port)) { diff --git a/libraries/ESP8266WiFi/src/include/ClientContext.h b/libraries/ESP8266WiFi/src/include/ClientContext.h index 47407bc00b..8095e402a2 100644 --- a/libraries/ESP8266WiFi/src/include/ClientContext.h +++ b/libraries/ESP8266WiFi/src/include/ClientContext.h @@ -374,7 +374,7 @@ class ClientContext if (!_pcb) { return 0; } - return _write_from_source(new (std::nothrow) BufferDataSource(data, size)); + return _write_from_source(new BufferDataSource(data, size)); } size_t write(Stream& stream) @@ -382,7 +382,7 @@ class ClientContext if (!_pcb) { return 0; } - return _write_from_source(new (std::nothrow) BufferedStreamDataSource(stream, stream.available())); + return _write_from_source(new BufferedStreamDataSource(stream, stream.available())); } size_t write_P(PGM_P buf, size_t size) @@ -391,7 +391,7 @@ class ClientContext return 0; } ProgmemStream stream(buf, size); - return _write_from_source(new (std::nothrow) BufferedStreamDataSource(stream, size)); + return _write_from_source(new BufferedStreamDataSource(stream, size)); } void keepAlive (uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT) diff --git a/libraries/ESP8266WiFi/src/include/DataSource.h b/libraries/ESP8266WiFi/src/include/DataSource.h index 624a9277e7..2a0bfed260 100644 --- a/libraries/ESP8266WiFi/src/include/DataSource.h +++ b/libraries/ESP8266WiFi/src/include/DataSource.h @@ -75,7 +75,7 @@ class BufferedStreamDataSource : public DataSource { //Buffer too small? if (_bufferSize < min_buffer_size) { - uint8_t *new_buffer = new (std::nothrow) uint8_t[min_buffer_size]; + uint8_t *new_buffer = new uint8_t[min_buffer_size]; //If stream reading is ahead, than some data is already in the old buffer and needs to be copied to new resized buffer if (_buffer && stream_read > 0) { memcpy(new_buffer, _buffer.get(), stream_read); diff --git a/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino b/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino index 26fd06fbdf..e196ef6419 100644 --- a/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino +++ b/libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino @@ -74,9 +74,9 @@ void setup() { WiFiMulti.addAP(STASSID, STAPSK); #if MANUAL_SIGNING - signPubKey = new (std::nothrow) BearSSL::PublicKey(pubkey); - hash = new (std::nothrow) BearSSL::HashSHA256(); - sign = new (std::nothrow) BearSSL::SigningVerifier(signPubKey); + signPubKey = new BearSSL::PublicKey(pubkey); + hash = new BearSSL::HashSHA256(); + sign = new BearSSL::SigningVerifier(signPubKey); #endif } diff --git a/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp b/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp index c15ead17bb..8791195523 100644 --- a/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp +++ b/libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.cpp @@ -225,11 +225,7 @@ bool MDNSResponder::_listen() return false; } - _conn = new (std::nothrow) UdpContext; - if (_conn == nullptr) - { - return false; - } + _conn = new UdpContext; _conn->ref(); if (!_conn->listen(IP_ADDR_ANY, MDNS_PORT)) @@ -280,11 +276,7 @@ bool MDNSResponder::addServiceTxt(char *name, char *proto, char *key, char *valu { return false; //max txt record size } - MDNSTxt *newtxt = new (std::nothrow) MDNSTxt; - if (newtxt == nullptr) - { - return false; - } + MDNSTxt *newtxt = new MDNSTxt; newtxt->_txt = String(key) + '=' + String(value); newtxt->_next = 0; if (servicePtr->_txts == 0) //no services have been added diff --git a/libraries/LittleFS/src/LittleFS.cpp b/libraries/LittleFS/src/LittleFS.cpp index 6de443fff3..7fd4351fcb 100644 --- a/libraries/LittleFS/src/LittleFS.cpp +++ b/libraries/LittleFS/src/LittleFS.cpp @@ -203,7 +203,7 @@ int LittleFSImpl::lfs_flash_sync(const struct lfs_config *c) { #endif #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_LITTLEFS) -FS LittleFS = FS(FSImplPtr(new (std::nothrow) littlefs_impl::LittleFSImpl(FS_PHYS_ADDR, FS_PHYS_SIZE, FS_PHYS_PAGE, FS_PHYS_BLOCK, FS_MAX_OPEN_FILES))); +FS LittleFS = FS(FSImplPtr(new littlefs_impl::LittleFSImpl(FS_PHYS_ADDR, FS_PHYS_SIZE, FS_PHYS_PAGE, FS_PHYS_BLOCK, FS_MAX_OPEN_FILES))); extern "C" void littlefs_request_end(void) { diff --git a/libraries/LittleFS/src/LittleFS.h b/libraries/LittleFS/src/LittleFS.h index 7af4c0e2b9..f78680f662 100644 --- a/libraries/LittleFS/src/LittleFS.h +++ b/libraries/LittleFS/src/LittleFS.h @@ -324,11 +324,7 @@ class LittleFSFileImpl : public FileImpl { public: LittleFSFileImpl(LittleFSImpl* fs, const char *name, std::shared_ptr fd, int flags, time_t creation) : _fs(fs), _fd(fd), _opened(true), _flags(flags), _creation(creation) { - _name = std::shared_ptr(new (std::nothrow) char[strlen(name) + 1], std::default_delete()); - if (!_name) { - close(); - return; - } + _name = std::shared_ptr(new char[strlen(name) + 1], std::default_delete()); strcpy(_name.get(), name); } @@ -521,26 +517,17 @@ class LittleFSDirImpl : public DirImpl { memset(&_dirent, 0, sizeof(_dirent)); if (dirPath) { - _dirPath = std::shared_ptr(new (std::nothrow) char[strlen(dirPath) + 1], std::default_delete()); - if (_dirPath == nullptr) { - close(); - return; - } + _dirPath = std::shared_ptr(new char[strlen(dirPath) + 1], std::default_delete()); strcpy(_dirPath.get(), dirPath); } } - void close () { + ~LittleFSDirImpl() override { if (_opened) { lfs_dir_close(_fs->getFS(), _getDir()); - _opened = false; } } - ~LittleFSDirImpl() override { - close(); - } - FileImplPtr openFile(OpenMode openMode, AccessMode accessMode) override { if (!_valid) { return FileImplPtr(); diff --git a/libraries/SDFS/src/SDFS.cpp b/libraries/SDFS/src/SDFS.cpp index 90ef270dcc..d862ff5d89 100644 --- a/libraries/SDFS/src/SDFS.cpp +++ b/libraries/SDFS/src/SDFS.cpp @@ -32,7 +32,7 @@ using namespace fs; #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SDFS) -FS SDFS = FS(FSImplPtr(new (std::nothrow) sdfs::SDFSImpl())); +FS SDFS = FS(FSImplPtr(new sdfs::SDFSImpl())); #endif namespace sdfs { diff --git a/libraries/esp8266/examples/ConfigFile/ConfigFile.ino b/libraries/esp8266/examples/ConfigFile/ConfigFile.ino index d03c19790a..cb1d25be07 100644 --- a/libraries/esp8266/examples/ConfigFile/ConfigFile.ino +++ b/libraries/esp8266/examples/ConfigFile/ConfigFile.ino @@ -25,10 +25,7 @@ bool loadConfig() { } // Allocate a buffer to store contents of the file. - std::unique_ptr buf(new (std::nothrow) char[size]); - if (buf == nullptr) { - return false; - } + std::unique_ptr buf(new char[size]); // We don't use String here because ArduinoJson library requires the input // buffer to be mutable. If you don't use ArduinoJson, you may as well diff --git a/libraries/esp8266/examples/SerialStress/SerialStress.ino b/libraries/esp8266/examples/SerialStress/SerialStress.ino index b93e443601..1412abd2be 100644 --- a/libraries/esp8266/examples/SerialStress/SerialStress.ino +++ b/libraries/esp8266/examples/SerialStress/SerialStress.ino @@ -72,7 +72,7 @@ void setup() { // using HardwareSerial0 pins, // so we can still log to the regular usbserial chips - SoftwareSerial* ss = new (std::nothrow) SoftwareSerial(3, 1); + SoftwareSerial* ss = new SoftwareSerial(3, 1); ss->begin(SSBAUD); ss->enableIntTx(false); logger = ss; diff --git a/tools/boards.txt.py b/tools/boards.txt.py index 7be8f695dc..95d6dc43f4 100755 --- a/tools/boards.txt.py +++ b/tools/boards.txt.py @@ -994,10 +994,10 @@ ]), 'exception_menu': collections.OrderedDict([ - ( '.menu.exception.legacy', 'Legacy (new can return nullptr)' ), - ( '.menu.exception.legacy.build.exception_flags', '-fno-exceptions' ), - ( '.menu.exception.legacy.build.stdcpp_lib', '-lstdc++' ), - ( '.menu.exception.disabled', 'Disabled (new can abort)' ), + #( '.menu.exception.legacy', 'Legacy (new returns nullptr on oom, constructor issue)' ), + #( '.menu.exception.legacy.build.exception_flags', '-fno-exceptions' ), + #( '.menu.exception.legacy.build.stdcpp_lib', '-lstdc++' ), + ( '.menu.exception.disabled', 'Disabled (new aborts on oom)' ), ( '.menu.exception.disabled.build.exception_flags', '-fno-exceptions -DNEW_OOM_ABORT' ), ( '.menu.exception.disabled.build.stdcpp_lib', '-lstdc++' ), ( '.menu.exception.enabled', 'Enabled' ), From 2b6423edccfb9edd696a573af9698547a66b2dd1 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Mon, 24 Aug 2020 22:15:33 +0200 Subject: [PATCH 5/8] new w/ OOM raises an exception, shows the caller address for decoders --- cores/esp8266/abi.cpp | 14 ++++++++++++-- cores/esp8266/core_esp8266_postmortem.cpp | 4 ++++ cores/esp8266/debug.h | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cores/esp8266/abi.cpp b/cores/esp8266/abi.cpp index fe63354100..feacc5eb85 100644 --- a/cores/esp8266/abi.cpp +++ b/cores/esp8266/abi.cpp @@ -32,13 +32,19 @@ extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); -#if !defined(__cpp_exceptions) && !defined(NEW_OOM_ABORT) +#if !defined(__cpp_exceptions) + +// overwrite weak operators new/new[] definitions + void *operator new(size_t size) { void *ret = malloc(size); if (0 != size && 0 == ret) { umm_last_fail_alloc_addr = __builtin_return_address(0); umm_last_fail_alloc_size = size; +#if defined(NEW_OOM_ABORT) + __unhandled_exception(PSTR("OOM")); +#endif } return ret; } @@ -49,10 +55,14 @@ void *operator new[](size_t size) if (0 != size && 0 == ret) { umm_last_fail_alloc_addr = __builtin_return_address(0); umm_last_fail_alloc_size = size; +#if defined(NEW_OOM_ABORT) + __unhandled_exception(PSTR("OOM")); +#endif } return ret; } -#endif // arduino's std::new legacy + +#endif // !defined(__cpp_exceptions) void __cxa_pure_virtual(void) { diff --git a/cores/esp8266/core_esp8266_postmortem.cpp b/cores/esp8266/core_esp8266_postmortem.cpp index f79ebace85..8e10a0eddd 100644 --- a/cores/esp8266/core_esp8266_postmortem.cpp +++ b/cores/esp8266/core_esp8266_postmortem.cpp @@ -220,6 +220,10 @@ void __wrap_system_restart_local() { cut_here(); + // now outside from the "cut-here" zone, print correctly the malloc address, + // idf-monitor.py will be able to decode this one and show exact location in sources + ets_printf_P(PSTR("\nlast failed alloc call: 0x%08x\n"), (uint32_t)umm_last_fail_alloc_addr); + custom_crash_callback( &rst_info, sp_dump + offset, stack_end ); ets_delay_us(10000); diff --git a/cores/esp8266/debug.h b/cores/esp8266/debug.h index fab128253c..c48b79a14c 100644 --- a/cores/esp8266/debug.h +++ b/cores/esp8266/debug.h @@ -22,6 +22,7 @@ void hexdump(const void *mem, uint32_t len, uint8_t cols); extern "C" { #endif +void __unhandled_exception(const char *str) __attribute__((noreturn)); void __panic_func(const char* file, int line, const char* func) __attribute__((noreturn)); #define panic() __panic_func(PSTR(__FILE__), __LINE__, __func__) From c111713208fd3cd7d21c6b6868a16aaeec958b57 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Mon, 24 Aug 2020 22:42:29 +0200 Subject: [PATCH 6/8] overwrite weak `new (std::nothrow)` calls --- cores/esp8266/abi.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/cores/esp8266/abi.cpp b/cores/esp8266/abi.cpp index feacc5eb85..aa031e6406 100644 --- a/cores/esp8266/abi.cpp +++ b/cores/esp8266/abi.cpp @@ -36,28 +36,44 @@ extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); // overwrite weak operators new/new[] definitions -void *operator new(size_t size) +void* operator new(size_t size) { void *ret = malloc(size); if (0 != size && 0 == ret) { umm_last_fail_alloc_addr = __builtin_return_address(0); umm_last_fail_alloc_size = size; -#if defined(NEW_OOM_ABORT) __unhandled_exception(PSTR("OOM")); -#endif } - return ret; + return ret; } -void *operator new[](size_t size) +void* operator new[](size_t size) { void *ret = malloc(size); if (0 != size && 0 == ret) { umm_last_fail_alloc_addr = __builtin_return_address(0); umm_last_fail_alloc_size = size; -#if defined(NEW_OOM_ABORT) __unhandled_exception(PSTR("OOM")); -#endif + } + return ret; +} + +void* operator new (size_t size, const std::nothrow_t&) +{ + void *ret = malloc(size); + if (0 != size && 0 == ret) { + umm_last_fail_alloc_addr = __builtin_return_address(0); + umm_last_fail_alloc_size = size; + } + return ret; +} + +void* operator new[] (size_t size, const std::nothrow_t&) +{ + void *ret = malloc(size); + if (0 != size && 0 == ret) { + umm_last_fail_alloc_addr = __builtin_return_address(0); + umm_last_fail_alloc_size = size; } return ret; } From f23e765ab197ac0c003eea88a9168ae8e642511f Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 25 Aug 2020 11:00:48 +0200 Subject: [PATCH 7/8] fix displaying caller address --- cores/esp8266/core_esp8266_postmortem.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cores/esp8266/core_esp8266_postmortem.cpp b/cores/esp8266/core_esp8266_postmortem.cpp index 8e10a0eddd..3e75342d05 100644 --- a/cores/esp8266/core_esp8266_postmortem.cpp +++ b/cores/esp8266/core_esp8266_postmortem.cpp @@ -220,9 +220,11 @@ void __wrap_system_restart_local() { cut_here(); - // now outside from the "cut-here" zone, print correctly the malloc address, - // idf-monitor.py will be able to decode this one and show exact location in sources - ets_printf_P(PSTR("\nlast failed alloc call: 0x%08x\n"), (uint32_t)umm_last_fail_alloc_addr); + if (s_unhandled_exception && umm_last_fail_alloc_addr) { + // now outside from the "cut-here" zone, print correctly the `new` caller address, + // idf-monitor.py will be able to decode this one and show exact location in sources + ets_printf_P(PSTR("\nlast failed alloc caller: 0x%08x\n"), (uint32_t)umm_last_fail_alloc_addr); + } custom_crash_callback( &rst_info, sp_dump + offset, stack_end ); From 3ee6710fa575dafab00ded31857165ea0506d76d Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 25 Aug 2020 11:04:30 +0200 Subject: [PATCH 8/8] board generator: remove comments, remove now useless define --- boards.txt | 68 ++++++++++++++++++++++----------------------- tools/boards.txt.py | 5 +--- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/boards.txt b/boards.txt index afd7fb0261..a5c721203b 100644 --- a/boards.txt +++ b/boards.txt @@ -50,7 +50,7 @@ generic.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM generic.menu.vt.iram=IRAM generic.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM generic.menu.exception.disabled=Disabled (new aborts on oom) -generic.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +generic.menu.exception.disabled.build.exception_flags=-fno-exceptions generic.menu.exception.disabled.build.stdcpp_lib=-lstdc++ generic.menu.exception.enabled=Enabled generic.menu.exception.enabled.build.exception_flags=-fexceptions @@ -519,7 +519,7 @@ esp8285.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM esp8285.menu.vt.iram=IRAM esp8285.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM esp8285.menu.exception.disabled=Disabled (new aborts on oom) -esp8285.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +esp8285.menu.exception.disabled.build.exception_flags=-fno-exceptions esp8285.menu.exception.disabled.build.stdcpp_lib=-lstdc++ esp8285.menu.exception.enabled=Enabled esp8285.menu.exception.enabled.build.exception_flags=-fexceptions @@ -854,7 +854,7 @@ espduino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espduino.menu.vt.iram=IRAM espduino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM espduino.menu.exception.disabled=Disabled (new aborts on oom) -espduino.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +espduino.menu.exception.disabled.build.exception_flags=-fno-exceptions espduino.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espduino.menu.exception.enabled=Enabled espduino.menu.exception.enabled.build.exception_flags=-fexceptions @@ -1040,7 +1040,7 @@ huzzah.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM huzzah.menu.vt.iram=IRAM huzzah.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM huzzah.menu.exception.disabled=Disabled (new aborts on oom) -huzzah.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +huzzah.menu.exception.disabled.build.exception_flags=-fno-exceptions huzzah.menu.exception.disabled.build.stdcpp_lib=-lstdc++ huzzah.menu.exception.enabled=Enabled huzzah.menu.exception.enabled.build.exception_flags=-fexceptions @@ -1227,7 +1227,7 @@ inventone.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM inventone.menu.vt.iram=IRAM inventone.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM inventone.menu.exception.disabled=Disabled (new aborts on oom) -inventone.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +inventone.menu.exception.disabled.build.exception_flags=-fno-exceptions inventone.menu.exception.disabled.build.stdcpp_lib=-lstdc++ inventone.menu.exception.enabled=Enabled inventone.menu.exception.enabled.build.exception_flags=-fexceptions @@ -1414,7 +1414,7 @@ cw01.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM cw01.menu.vt.iram=IRAM cw01.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM cw01.menu.exception.disabled=Disabled (new aborts on oom) -cw01.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +cw01.menu.exception.disabled.build.exception_flags=-fno-exceptions cw01.menu.exception.disabled.build.stdcpp_lib=-lstdc++ cw01.menu.exception.enabled=Enabled cw01.menu.exception.enabled.build.exception_flags=-fexceptions @@ -1604,7 +1604,7 @@ espresso_lite_v1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espresso_lite_v1.menu.vt.iram=IRAM espresso_lite_v1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM espresso_lite_v1.menu.exception.disabled=Disabled (new aborts on oom) -espresso_lite_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +espresso_lite_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions espresso_lite_v1.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espresso_lite_v1.menu.exception.enabled=Enabled espresso_lite_v1.menu.exception.enabled.build.exception_flags=-fexceptions @@ -1794,7 +1794,7 @@ espresso_lite_v2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espresso_lite_v2.menu.vt.iram=IRAM espresso_lite_v2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM espresso_lite_v2.menu.exception.disabled=Disabled (new aborts on oom) -espresso_lite_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +espresso_lite_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions espresso_lite_v2.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espresso_lite_v2.menu.exception.enabled=Enabled espresso_lite_v2.menu.exception.enabled.build.exception_flags=-fexceptions @@ -1984,7 +1984,7 @@ phoenix_v1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM phoenix_v1.menu.vt.iram=IRAM phoenix_v1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM phoenix_v1.menu.exception.disabled=Disabled (new aborts on oom) -phoenix_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +phoenix_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions phoenix_v1.menu.exception.disabled.build.stdcpp_lib=-lstdc++ phoenix_v1.menu.exception.enabled=Enabled phoenix_v1.menu.exception.enabled.build.exception_flags=-fexceptions @@ -2174,7 +2174,7 @@ phoenix_v2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM phoenix_v2.menu.vt.iram=IRAM phoenix_v2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM phoenix_v2.menu.exception.disabled=Disabled (new aborts on oom) -phoenix_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +phoenix_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions phoenix_v2.menu.exception.disabled.build.stdcpp_lib=-lstdc++ phoenix_v2.menu.exception.enabled=Enabled phoenix_v2.menu.exception.enabled.build.exception_flags=-fexceptions @@ -2364,7 +2364,7 @@ nodemcu.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM nodemcu.menu.vt.iram=IRAM nodemcu.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM nodemcu.menu.exception.disabled=Disabled (new aborts on oom) -nodemcu.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +nodemcu.menu.exception.disabled.build.exception_flags=-fno-exceptions nodemcu.menu.exception.disabled.build.stdcpp_lib=-lstdc++ nodemcu.menu.exception.enabled=Enabled nodemcu.menu.exception.enabled.build.exception_flags=-fexceptions @@ -2551,7 +2551,7 @@ nodemcuv2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM nodemcuv2.menu.vt.iram=IRAM nodemcuv2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM nodemcuv2.menu.exception.disabled=Disabled (new aborts on oom) -nodemcuv2.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +nodemcuv2.menu.exception.disabled.build.exception_flags=-fno-exceptions nodemcuv2.menu.exception.disabled.build.stdcpp_lib=-lstdc++ nodemcuv2.menu.exception.enabled=Enabled nodemcuv2.menu.exception.enabled.build.exception_flags=-fexceptions @@ -2742,7 +2742,7 @@ modwifi.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM modwifi.menu.vt.iram=IRAM modwifi.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM modwifi.menu.exception.disabled=Disabled (new aborts on oom) -modwifi.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +modwifi.menu.exception.disabled.build.exception_flags=-fno-exceptions modwifi.menu.exception.disabled.build.stdcpp_lib=-lstdc++ modwifi.menu.exception.enabled=Enabled modwifi.menu.exception.enabled.build.exception_flags=-fexceptions @@ -2949,7 +2949,7 @@ thing.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM thing.menu.vt.iram=IRAM thing.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM thing.menu.exception.disabled=Disabled (new aborts on oom) -thing.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +thing.menu.exception.disabled.build.exception_flags=-fno-exceptions thing.menu.exception.disabled.build.stdcpp_lib=-lstdc++ thing.menu.exception.enabled=Enabled thing.menu.exception.enabled.build.exception_flags=-fexceptions @@ -3136,7 +3136,7 @@ thingdev.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM thingdev.menu.vt.iram=IRAM thingdev.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM thingdev.menu.exception.disabled=Disabled (new aborts on oom) -thingdev.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +thingdev.menu.exception.disabled.build.exception_flags=-fno-exceptions thingdev.menu.exception.disabled.build.stdcpp_lib=-lstdc++ thingdev.menu.exception.enabled=Enabled thingdev.menu.exception.enabled.build.exception_flags=-fexceptions @@ -3323,7 +3323,7 @@ blynk.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM blynk.menu.vt.iram=IRAM blynk.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM blynk.menu.exception.disabled=Disabled (new aborts on oom) -blynk.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +blynk.menu.exception.disabled.build.exception_flags=-fno-exceptions blynk.menu.exception.disabled.build.stdcpp_lib=-lstdc++ blynk.menu.exception.enabled=Enabled blynk.menu.exception.enabled.build.exception_flags=-fexceptions @@ -3510,7 +3510,7 @@ esp210.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM esp210.menu.vt.iram=IRAM esp210.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM esp210.menu.exception.disabled=Disabled (new aborts on oom) -esp210.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +esp210.menu.exception.disabled.build.exception_flags=-fno-exceptions esp210.menu.exception.disabled.build.stdcpp_lib=-lstdc++ esp210.menu.exception.enabled=Enabled esp210.menu.exception.enabled.build.exception_flags=-fexceptions @@ -3697,7 +3697,7 @@ d1_mini.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1_mini.menu.vt.iram=IRAM d1_mini.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM d1_mini.menu.exception.disabled=Disabled (new aborts on oom) -d1_mini.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +d1_mini.menu.exception.disabled.build.exception_flags=-fno-exceptions d1_mini.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1_mini.menu.exception.enabled=Enabled d1_mini.menu.exception.enabled.build.exception_flags=-fexceptions @@ -3884,7 +3884,7 @@ d1_mini_pro.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1_mini_pro.menu.vt.iram=IRAM d1_mini_pro.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM d1_mini_pro.menu.exception.disabled=Disabled (new aborts on oom) -d1_mini_pro.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +d1_mini_pro.menu.exception.disabled.build.exception_flags=-fno-exceptions d1_mini_pro.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1_mini_pro.menu.exception.enabled=Enabled d1_mini_pro.menu.exception.enabled.build.exception_flags=-fexceptions @@ -4054,7 +4054,7 @@ d1_mini_lite.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1_mini_lite.menu.vt.iram=IRAM d1_mini_lite.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM d1_mini_lite.menu.exception.disabled=Disabled (new aborts on oom) -d1_mini_lite.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +d1_mini_lite.menu.exception.disabled.build.exception_flags=-fno-exceptions d1_mini_lite.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1_mini_lite.menu.exception.enabled=Enabled d1_mini_lite.menu.exception.enabled.build.exception_flags=-fexceptions @@ -4281,7 +4281,7 @@ d1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM d1.menu.vt.iram=IRAM d1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM d1.menu.exception.disabled=Disabled (new aborts on oom) -d1.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +d1.menu.exception.disabled.build.exception_flags=-fno-exceptions d1.menu.exception.disabled.build.stdcpp_lib=-lstdc++ d1.menu.exception.enabled=Enabled d1.menu.exception.enabled.build.exception_flags=-fexceptions @@ -4468,7 +4468,7 @@ espino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espino.menu.vt.iram=IRAM espino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM espino.menu.exception.disabled=Disabled (new aborts on oom) -espino.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +espino.menu.exception.disabled.build.exception_flags=-fno-exceptions espino.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espino.menu.exception.enabled=Enabled espino.menu.exception.enabled.build.exception_flags=-fexceptions @@ -4658,7 +4658,7 @@ espinotee.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espinotee.menu.vt.iram=IRAM espinotee.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM espinotee.menu.exception.disabled=Disabled (new aborts on oom) -espinotee.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +espinotee.menu.exception.disabled.build.exception_flags=-fno-exceptions espinotee.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espinotee.menu.exception.enabled=Enabled espinotee.menu.exception.enabled.build.exception_flags=-fexceptions @@ -4862,7 +4862,7 @@ wifinfo.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wifinfo.menu.vt.iram=IRAM wifinfo.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM wifinfo.menu.exception.disabled=Disabled (new aborts on oom) -wifinfo.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +wifinfo.menu.exception.disabled.build.exception_flags=-fno-exceptions wifinfo.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wifinfo.menu.exception.enabled=Enabled wifinfo.menu.exception.enabled.build.exception_flags=-fexceptions @@ -5108,7 +5108,7 @@ arduino-esp8266.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM arduino-esp8266.menu.vt.iram=IRAM arduino-esp8266.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM arduino-esp8266.menu.exception.disabled=Disabled (new aborts on oom) -arduino-esp8266.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +arduino-esp8266.menu.exception.disabled.build.exception_flags=-fno-exceptions arduino-esp8266.menu.exception.disabled.build.stdcpp_lib=-lstdc++ arduino-esp8266.menu.exception.enabled=Enabled arduino-esp8266.menu.exception.enabled.build.exception_flags=-fexceptions @@ -5296,7 +5296,7 @@ gen4iod.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM gen4iod.menu.vt.iram=IRAM gen4iod.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM gen4iod.menu.exception.disabled=Disabled (new aborts on oom) -gen4iod.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +gen4iod.menu.exception.disabled.build.exception_flags=-fno-exceptions gen4iod.menu.exception.disabled.build.stdcpp_lib=-lstdc++ gen4iod.menu.exception.enabled=Enabled gen4iod.menu.exception.enabled.build.exception_flags=-fexceptions @@ -5551,7 +5551,7 @@ oak.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM oak.menu.vt.iram=IRAM oak.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM oak.menu.exception.disabled=Disabled (new aborts on oom) -oak.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +oak.menu.exception.disabled.build.exception_flags=-fno-exceptions oak.menu.exception.disabled.build.stdcpp_lib=-lstdc++ oak.menu.exception.enabled=Enabled oak.menu.exception.enabled.build.exception_flags=-fexceptions @@ -5738,7 +5738,7 @@ wifiduino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wifiduino.menu.vt.iram=IRAM wifiduino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM wifiduino.menu.exception.disabled=Disabled (new aborts on oom) -wifiduino.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +wifiduino.menu.exception.disabled.build.exception_flags=-fno-exceptions wifiduino.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wifiduino.menu.exception.enabled=Enabled wifiduino.menu.exception.enabled.build.exception_flags=-fexceptions @@ -5925,7 +5925,7 @@ wifi_slot.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wifi_slot.menu.vt.iram=IRAM wifi_slot.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM wifi_slot.menu.exception.disabled=Disabled (new aborts on oom) -wifi_slot.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +wifi_slot.menu.exception.disabled.build.exception_flags=-fno-exceptions wifi_slot.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wifi_slot.menu.exception.enabled=Enabled wifi_slot.menu.exception.enabled.build.exception_flags=-fexceptions @@ -6226,7 +6226,7 @@ wiolink.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM wiolink.menu.vt.iram=IRAM wiolink.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM wiolink.menu.exception.disabled=Disabled (new aborts on oom) -wiolink.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +wiolink.menu.exception.disabled.build.exception_flags=-fno-exceptions wiolink.menu.exception.disabled.build.stdcpp_lib=-lstdc++ wiolink.menu.exception.enabled=Enabled wiolink.menu.exception.enabled.build.exception_flags=-fexceptions @@ -6413,7 +6413,7 @@ espectro.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espectro.menu.vt.iram=IRAM espectro.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM espectro.menu.exception.disabled=Disabled (new aborts on oom) -espectro.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +espectro.menu.exception.disabled.build.exception_flags=-fno-exceptions espectro.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espectro.menu.exception.enabled=Enabled espectro.menu.exception.enabled.build.exception_flags=-fexceptions @@ -6600,7 +6600,7 @@ eduinowifi.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM eduinowifi.menu.vt.iram=IRAM eduinowifi.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM eduinowifi.menu.exception.disabled=Disabled (new aborts on oom) -eduinowifi.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +eduinowifi.menu.exception.disabled.build.exception_flags=-fno-exceptions eduinowifi.menu.exception.disabled.build.stdcpp_lib=-lstdc++ eduinowifi.menu.exception.enabled=Enabled eduinowifi.menu.exception.enabled.build.exception_flags=-fexceptions @@ -6797,7 +6797,7 @@ sonoff.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM sonoff.menu.vt.iram=IRAM sonoff.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM sonoff.menu.exception.disabled=Disabled (new aborts on oom) -sonoff.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +sonoff.menu.exception.disabled.build.exception_flags=-fno-exceptions sonoff.menu.exception.disabled.build.stdcpp_lib=-lstdc++ sonoff.menu.exception.enabled=Enabled sonoff.menu.exception.enabled.build.exception_flags=-fexceptions @@ -7025,7 +7025,7 @@ espmxdevkit.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM espmxdevkit.menu.vt.iram=IRAM espmxdevkit.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM espmxdevkit.menu.exception.disabled=Disabled (new aborts on oom) -espmxdevkit.menu.exception.disabled.build.exception_flags=-fno-exceptions -DNEW_OOM_ABORT +espmxdevkit.menu.exception.disabled.build.exception_flags=-fno-exceptions espmxdevkit.menu.exception.disabled.build.stdcpp_lib=-lstdc++ espmxdevkit.menu.exception.enabled=Enabled espmxdevkit.menu.exception.enabled.build.exception_flags=-fexceptions diff --git a/tools/boards.txt.py b/tools/boards.txt.py index 95d6dc43f4..3ecd46ab66 100755 --- a/tools/boards.txt.py +++ b/tools/boards.txt.py @@ -994,11 +994,8 @@ ]), 'exception_menu': collections.OrderedDict([ - #( '.menu.exception.legacy', 'Legacy (new returns nullptr on oom, constructor issue)' ), - #( '.menu.exception.legacy.build.exception_flags', '-fno-exceptions' ), - #( '.menu.exception.legacy.build.stdcpp_lib', '-lstdc++' ), ( '.menu.exception.disabled', 'Disabled (new aborts on oom)' ), - ( '.menu.exception.disabled.build.exception_flags', '-fno-exceptions -DNEW_OOM_ABORT' ), + ( '.menu.exception.disabled.build.exception_flags', '-fno-exceptions' ), ( '.menu.exception.disabled.build.stdcpp_lib', '-lstdc++' ), ( '.menu.exception.enabled', 'Enabled' ), ( '.menu.exception.enabled.build.exception_flags', '-fexceptions' ), pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy