Merge pull request #1206 from cpainchaud/patch-1

fix potential memory leak in  WiFiManagerParameter::setValue
This commit is contained in:
Shawn A
2021-03-11 13:25:27 -06:00
committed by GitHub
+6 -2
View File
@@ -86,8 +86,12 @@ void WiFiManagerParameter::setValue(const char *defaultValue, int length) {
// // return false; //@todo bail
// }
_length = length;
_value = new char[_length + 1];
if(_length != length){
_length = length;
if( _value != nullptr)
delete[] _value;
_value = new char[_length + 1];
}
memset(_value, 0, _length + 1); // explicit null
if (defaultValue != NULL) {