diff --git a/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino b/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino index ec621bb79..50e926efe 100644 --- a/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino +++ b/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino @@ -30,10 +30,10 @@ void setup() { Serial.println("Start"); }); ArduinoOTA.onEnd([]() { - Serial.println("End"); + Serial.println("\nEnd"); }); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { - Serial.printf("Progress: %u%%\n", (progress / (total / 100))); + Serial.printf("Progress: %u%%\r", (progress / (total / 100))); }); ArduinoOTA.onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); diff --git a/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp b/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp index 67e42c090..cecc8eabc 100644 --- a/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp +++ b/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp @@ -87,17 +87,25 @@ bool ESP8266WebServer::authenticate(const char * username, const char * password authReq.trim(); char toencodeLen = strlen(username)+strlen(password)+1; char *toencode = new char[toencodeLen]; - if(toencode == NULL) + if(toencode == NULL){ + authReq = String(); return false; + } char *encoded = new char[base64_encode_expected_len(toencodeLen)+1]; - if(encoded == NULL) + if(encoded == NULL){ + authReq = String(); + delete[] toencode; return false; - + } sprintf(toencode, "%s:%s", username, password); if(base64_encode_chars(toencode, toencodeLen, encoded) > 0 && authReq.equals(encoded)){ authReq = String(); + delete[] toencode; + delete[] encoded; return true; } + delete[] toencode; + delete[] encoded; } authReq = String(); }