forked from me-no-dev/ESPAsyncWebServer
Merge pull request #18 from andig/fix-lowmem
Gracefully handle out of memory
This commit is contained in:
@@ -267,6 +267,10 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
|
|||||||
outLen = (remaining > space)?space:remaining;
|
outLen = (remaining > space)?space:remaining;
|
||||||
}
|
}
|
||||||
uint8_t *buf = (uint8_t *)malloc(outLen);
|
uint8_t *buf = (uint8_t *)malloc(outLen);
|
||||||
|
if (!buf) {
|
||||||
|
// os_printf("_ack malloc %d failed\n", outLen);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(_chunked){
|
if(_chunked){
|
||||||
readLen = _fillBuffer(buf, outLen - 8);
|
readLen = _fillBuffer(buf, outLen - 8);
|
||||||
|
Reference in New Issue
Block a user