@@ -977,7 +977,7 @@ extern "C" {
977
977
// Set custom list of ciphers
978
978
bool WiFiClientSecure::setCiphers (const uint16_t *cipherAry, int cipherCount) {
979
979
_cipher_list = nullptr ;
980
- _cipher_list = std::shared_ptr<uint16_t >(new uint16_t [cipherCount], std::default_delete<uint16_t []>());
980
+ _cipher_list = std::shared_ptr<uint16_t >(new (std::nothrow) uint16_t [cipherCount], std::default_delete<uint16_t []>());
981
981
if (!_cipher_list.get ()) {
982
982
DEBUG_BSSL (" setCiphers: list empty\n " );
983
983
return false ;
@@ -1067,8 +1067,8 @@ bool WiFiClientSecure::_connectSSL(const char* hostName) {
1067
1067
1068
1068
_sc = std::make_shared<br_ssl_client_context>();
1069
1069
_eng = &_sc->eng ; // Allocation/deallocation taken care of by the _sc shared_ptr
1070
- _iobuf_in = std::shared_ptr<unsigned char >(new unsigned char [_iobuf_in_size], std::default_delete<unsigned char []>());
1071
- _iobuf_out = std::shared_ptr<unsigned char >(new unsigned char [_iobuf_out_size], std::default_delete<unsigned char []>());
1070
+ _iobuf_in = std::shared_ptr<unsigned char >(new (std::nothrow) unsigned char [_iobuf_in_size], std::default_delete<unsigned char []>());
1071
+ _iobuf_out = std::shared_ptr<unsigned char >(new (std::nothrow) unsigned char [_iobuf_out_size], std::default_delete<unsigned char []>());
1072
1072
1073
1073
if (!_sc || !_iobuf_in || !_iobuf_out) {
1074
1074
_freeSSL (); // Frees _sc, _iobuf*
@@ -1183,8 +1183,8 @@ bool WiFiClientSecure::_connectSSLServerRSA(const X509List *chain,
1183
1183
_oom_err = false ;
1184
1184
_sc_svr = std::make_shared<br_ssl_server_context>();
1185
1185
_eng = &_sc_svr->eng ; // Allocation/deallocation taken care of by the _sc shared_ptr
1186
- _iobuf_in = std::shared_ptr<unsigned char >(new unsigned char [_iobuf_in_size], std::default_delete<unsigned char []>());
1187
- _iobuf_out = std::shared_ptr<unsigned char >(new unsigned char [_iobuf_out_size], std::default_delete<unsigned char []>());
1186
+ _iobuf_in = std::shared_ptr<unsigned char >(new (std::nothrow) unsigned char [_iobuf_in_size], std::default_delete<unsigned char []>());
1187
+ _iobuf_out = std::shared_ptr<unsigned char >(new (std::nothrow) unsigned char [_iobuf_out_size], std::default_delete<unsigned char []>());
1188
1188
1189
1189
if (!_sc_svr || !_iobuf_in || !_iobuf_out) {
1190
1190
_freeSSL ();
@@ -1220,8 +1220,8 @@ bool WiFiClientSecure::_connectSSLServerEC(const X509List *chain,
1220
1220
_oom_err = false ;
1221
1221
_sc_svr = std::make_shared<br_ssl_server_context>();
1222
1222
_eng = &_sc_svr->eng ; // Allocation/deallocation taken care of by the _sc shared_ptr
1223
- _iobuf_in = std::shared_ptr<unsigned char >(new unsigned char [_iobuf_in_size], std::default_delete<unsigned char []>());
1224
- _iobuf_out = std::shared_ptr<unsigned char >(new unsigned char [_iobuf_out_size], std::default_delete<unsigned char []>());
1223
+ _iobuf_in = std::shared_ptr<unsigned char >(new (std::nothrow) unsigned char [_iobuf_in_size], std::default_delete<unsigned char []>());
1224
+ _iobuf_out = std::shared_ptr<unsigned char >(new (std::nothrow) unsigned char [_iobuf_out_size], std::default_delete<unsigned char []>());
1225
1225
1226
1226
if (!_sc_svr || !_iobuf_in || !_iobuf_out) {
1227
1227
_freeSSL ();
@@ -1421,7 +1421,7 @@ bool WiFiClientSecure::probeMaxFragmentLength(IPAddress ip, uint16_t port, uint1
1421
1421
default : return false ; // Invalid size
1422
1422
}
1423
1423
int ttlLen = sizeof (clientHelloHead_P) + (2 + sizeof (suites_P)) + (sizeof (clientHelloTail_P) + 1 );
1424
- uint8_t *clientHello = new uint8_t [ttlLen];
1424
+ uint8_t *clientHello = new (std::nothrow) uint8_t [ttlLen];
1425
1425
if (!clientHello) {
1426
1426
DEBUG_BSSL (" probeMaxFragmentLength: OOM\n " );
1427
1427
return false ;
0 commit comments