From 02a4691a88dbf3ce67ded5e863a65c7efdc6acaf Mon Sep 17 00:00:00 2001 From: lokher Date: Sun, 16 Jul 2023 21:05:38 +0800 Subject: fix memory leak when using per key/row debounce --- keyboards/keychron/bluetooth/lpm_stm32l432.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'keyboards/keychron') 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; } -- cgit v1.2.3