Skip to content

Commit 00e69a2

Browse files
Jeroen88me-no-dev
Jeroen88
authored andcommitted
Redo PR espressif#2259 because I messed up my local git (espressif#2263)
1 parent 229d9b7 commit 00e69a2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

libraries/WiFi/src/WiFiClient.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class WiFiClientRxBuffer {
5858
{
5959
if(!_buffer){
6060
_buffer = (uint8_t *)malloc(_size);
61+
if(!_buffer) {
62+
log_e("Not enough memory to allocate buffer");
63+
_failed = true;
64+
return 0;
65+
}
6166
}
6267
if(_fill && _pos == _fill){
6368
_fill = 0;
@@ -67,8 +72,10 @@ class WiFiClientRxBuffer {
6772
return 0;
6873
}
6974
int res = recv(_fd, _buffer + _fill, _size - _fill, MSG_DONTWAIT);
70-
if(res < 0 && errno != EWOULDBLOCK) {
71-
_failed = true;
75+
if(res < 0) {
76+
if(errno != EWOULDBLOCK) {
77+
_failed = true;
78+
}
7279
return 0;
7380
}
7481
_fill += res;

0 commit comments

Comments
 (0)