Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e08429f

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

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎cores/esp32/esp32-hal-ledc.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-ledc.c
+2-2Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.