Skip to content

Commit 8cdcc2b

Browse files
committed
Use ps_malloc for web socket ws_pkt
1 parent 1dd9dca commit 8cdcc2b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Firmware/RTK_Everywhere/Form.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,13 @@ static esp_err_t ws_handler(httpd_req_t *req)
9494
systemPrintf("frame len is %d\r\n", ws_pkt.len);
9595
if (ws_pkt.len) {
9696
/* ws_pkt.len + 1 is for NULL termination as we are expecting a string */
97-
buf = (uint8_t *)calloc(1, ws_pkt.len + 1);
97+
if (online.psram == true)
98+
buf = (uint8_t *)ps_malloc(ws_pkt.len + 1);
99+
else
100+
buf = (uint8_t *)malloc(ws_pkt.len + 1);
101+
98102
if (buf == NULL) {
99-
systemPrintln("Failed to calloc memory for buf");
103+
systemPrintln("Failed to malloc memory for buf");
100104
return ESP_ERR_NO_MEM;
101105
}
102106
ws_pkt.payload = buf;

0 commit comments

Comments
 (0)