summaryrefslogtreecommitdiffstats
path: root/keyboards/keychron/bluetooth/lpm_stm32l432.c
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2023-07-16 21:05:38 +0800
committerlokher <lokher@gmail.com>2023-07-16 21:05:38 +0800
commit02a4691a88dbf3ce67ded5e863a65c7efdc6acaf (patch)
tree4cb4b8611bbe18317088f1685a478cf4b7cd4a8a /keyboards/keychron/bluetooth/lpm_stm32l432.c
parent627f1d1c5d750059a7923932102d33f860f5deed (diff)
fix memory leak when using per key/row debounce
Diffstat (limited to 'keyboards/keychron/bluetooth/lpm_stm32l432.c')
-rw-r--r--keyboards/keychron/bluetooth/lpm_stm32l432.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/keyboards/keychron/bluetooth/lpm_stm32l432.c b/keyboards/keychron/bluetooth/lpm_stm32l432.c
index 10b64731dd..288cb66765 100644
--- a/keyboards/keychron/bluetooth/lpm_stm32l432.c
+++ b/keyboards/keychron/bluetooth/lpm_stm32l432.c
@@ -31,6 +31,7 @@
#include "battery.h"
#include "report_buffer.h"
#include "stm32_bd.inc"
+#include "debounce.h"
extern pin_t row_pins[MATRIX_ROWS];
extern void select_all_cols(void);
@@ -248,6 +249,11 @@ void enter_power_mode(pm_t mode) {
lpm_wakeup();
lpm_timer_reset();
report_buffer_init();
+
+ /* Call debounce_free() to avoid memory leak as debounce_init() invoked in matrix_init() allocates
+ * new memory when using per row/key debounce
+ */
+ debounce_free();
matrix_init();
power_mode = PM_RUN;
}