forked from me-no-dev/ESPAsyncWebServer
Gracefully handle out of memory
This commit is contained in:
1 parent
e871a222fc
commit
9a291c876c
1 file changed
+4
@@ -267,6 +267,10 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
|
||||
outLen = (remaining > space)?space:remaining;
|
||||
}
|
||||
uint8_t *buf = (uint8_t *)malloc(outLen);
|
||||
if (!buf) {
|
||||
// os_printf("_ack malloc %d failed\n", outLen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(_chunked){
|
||||
readLen = _fillBuffer(buf, outLen - 8);
|
||||
|
||||
Reference in new issue
Block a user