diff --git a/main/config.c b/main/config.c index 3bacf7e5e..d7d6bd771 100644 --- a/main/config.c +++ b/main/config.c @@ -69,9 +69,11 @@ char *config_get_char(char *key) char *ret = NULL; cJSON *val = cJSON_GetObjectItemCaseSensitive(wc, key); if (cJSON_IsString(val) && val->valuestring != NULL) { + ESP_LOGI(TAG, "potentially leaking %d bytes of memory", strlen(val->valuestring)); ret = strndup(val->valuestring, strlen(val->valuestring)); } else { ESP_LOGW(TAG, "key %s not found in config, use bogus value to avoid NULL pointer dereference", key); + ESP_LOGI(TAG, "potentially leaking %d bytes of memory", 6); ret = strndup("bogus", 6); } return ret; diff --git a/main/endpoint/hass.c b/main/endpoint/hass.c index 74b7d5d11..b0103b71f 100644 --- a/main/endpoint/hass.c +++ b/main/endpoint/hass.c @@ -350,6 +350,9 @@ static void hass_post(const char *data) free(body); free(url); + + ESP_LOGI(TAG, "min_free_iram: %d", heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL)); + ESP_LOGI(TAG, "min_free_spiram: %d", heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM)); } static void hass_send_ws(const char *data) @@ -410,6 +413,8 @@ static void hass_send_ws(const char *data) ESP_LOGE(TAG, "failed to send command via WebSocket client"); } cJSON_Delete(cjson); + ESP_LOGI(TAG, "min_free_iram: %d", heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL)); + ESP_LOGI(TAG, "min_free_spiram: %d", heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM)); } void hass_send(const char *data) diff --git a/main/endpoint/rest.c b/main/endpoint/rest.c index aa8fd6b7d..543784bfd 100644 --- a/main/endpoint/rest.c +++ b/main/endpoint/rest.c @@ -75,6 +75,8 @@ void rest_send(const char *data) lvgl_port_unlock(); } + ESP_LOGI(TAG, "min_free_iram: %d", heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL)); + ESP_LOGI(TAG, "min_free_spiram: %d", heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM)); reset_timer(hdl_display_timer, DISPLAY_TIMEOUT_US, false); free(body);