fix(pthread): fix GCC 14 analyzer warnings

This commit is contained in:
Alexey Lapshin 2024-09-04 11:08:00 +07:00
parent 4d2881dac1
commit 5e4d6190d8

View File

@ -163,6 +163,7 @@ esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg)
/* If a value is already set, update that value */
esp_pthread_cfg_t *p = pthread_getspecific(s_pthread_cfg_key);
ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-malloc-leak") // ignore leak of 'p'
if (!p) {
p = malloc(sizeof(esp_pthread_cfg_t));
if (!p) {
@ -173,7 +174,6 @@ esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg)
p->stack_alloc_caps = heap_caps;
pthread_setspecific(s_pthread_cfg_key, p);
ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-malloc-leak") // ignore leak of 'p'
return 0;
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak")
}