8000 Fix Semaphore Handle leak · radiumray/arduino-esp32@e08429f · GitHub
[go: up one dir, main page]

Skip to content

Commit e08429f

Browse files
authored
Fix Semaphore Handle leak
code was allocating a semaphore handle on every write access.
1 parent cec3fca commit e08429f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp32/esp32-hal-ledc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#else
2929
#define LEDC_MUTEX_LOCK() do {} while (xSemaphoreTake(_ledc_sys_lock, portMAX_DELAY) != pdPASS)
3030
#define LEDC_MUTEX_UNLOCK() xSemaphoreGive(_ledc_sys_lock)
31-
xSemaphoreHandle _ledc_sys_lock;
31+
xSemaphoreHandle _ledc_sys_lock = NULL;
3232
#endif
3333

3434
/*
@@ -91,7 +91,7 @@ static void _ledcSetupTimer(uint8_t chan, uint32_t div_num, uint8_t bit_num, boo
9191
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST);
9292
LEDC.conf.apb_clk_sel = 1;//LS use apb clock
9393
#if !CONFIG_DISABLE_HAL_LOCKS
94-
_ledc_sys_lock = xSemaphoreCreateMutex();
94+
if( _ledc_sys_lock == NULL) _ledc_sys_lock = xSemaphoreCreateMutex();
9595
#endif
9696
}
9797
LEDC_MUTEX_LOCK();

0 commit comments

Comments
 (0)
0