From 76ddc45d6d8a5b814fb787a97fd2daadb44a1dda Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Fri, 12 Jun 2026 20:48:40 +0800 Subject: [PATCH] fix(esp_pm): malloc pm_lock in internal mem --- components/esp_pm/pm_locks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esp_pm/pm_locks.c b/components/esp_pm/pm_locks.c index 2a422a0ce60..85d54def3f0 100644 --- a/components/esp_pm/pm_locks.c +++ b/components/esp_pm/pm_locks.c @@ -9,6 +9,7 @@ #include #include "esp_pm.h" #include "esp_system.h" +#include "esp_heap_caps.h" #include "sys/queue.h" #include "freertos/FreeRTOS.h" #include "esp_private/pm_impl.h" @@ -56,7 +57,7 @@ esp_err_t esp_pm_lock_create(esp_pm_lock_type_t lock_type, int arg, if (out_handle == NULL) { return ESP_ERR_INVALID_ARG; } - esp_pm_lock_t* new_lock = (esp_pm_lock_t*) calloc(1, sizeof(*new_lock)); + esp_pm_lock_t* new_lock = (esp_pm_lock_t*) heap_caps_calloc(1, sizeof(*new_lock), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); if (!new_lock) { return ESP_ERR_NO_MEM; }