refactor: replace psram allocations with standard heap

Signed-off-by: Bo <boironic@gmail.com>
This commit is contained in:
Bo
2026-02-19 15:05:00 +08:00
parent ce198ccbe8
commit 0c256d7653
5 changed files with 9 additions and 17 deletions

View File

@@ -7,7 +7,6 @@
#include "esp_log.h"
#include "esp_http_client.h"
#include "esp_crt_bundle.h"
#include "esp_heap_caps.h"
#include "nvs.h"
#include "cJSON.h"
@@ -91,7 +90,7 @@ typedef struct {
static esp_err_t resp_buf_init(resp_buf_t *rb, size_t initial_cap)
{
rb->data = heap_caps_calloc(1, initial_cap, MALLOC_CAP_SPIRAM);
rb->data = calloc(1, initial_cap);
if (!rb->data) return ESP_ERR_NO_MEM;
rb->len = 0;
rb->cap = initial_cap;
@@ -102,7 +101,7 @@ static esp_err_t resp_buf_append(resp_buf_t *rb, const char *data, size_t len)
{
while (rb->len + len >= rb->cap) {
size_t new_cap = rb->cap * 2;
char *tmp = heap_caps_realloc(rb->data, new_cap, MALLOC_CAP_SPIRAM);
char *tmp = realloc(rb->data, new_cap);
if (!tmp) return ESP_ERR_NO_MEM;
rb->data = tmp;
rb->cap = new_cap;