From 7d7ce279d139bfd306f2dee586c198f1821bbf15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Mon, 13 Jan 2025 09:28:19 +0100 Subject: [PATCH] De-allocate memory used by timers on removal (#2936) * De-alocate memory used by timers on removal * CHANGELOG.md --- esp-wifi/CHANGELOG.md | 1 + esp-wifi/src/compat/timer_compat.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/esp-wifi/CHANGELOG.md b/esp-wifi/CHANGELOG.md index 2c19d763a..7baef61f1 100644 --- a/esp-wifi/CHANGELOG.md +++ b/esp-wifi/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed triggering a debug-assertion during scan (#2612) - Fix WPA2-ENTERPRISE functionality (#2896) +- Make sure to de-allocate memory used by timers on removal (#2936) ### Removed diff --git a/esp-wifi/src/compat/timer_compat.rs b/esp-wifi/src/compat/timer_compat.rs index 42b9e94e4..2c98529a5 100644 --- a/esp-wifi/src/compat/timer_compat.rs +++ b/esp-wifi/src/compat/timer_compat.rs @@ -112,6 +112,11 @@ impl TimerQueue { }; if let Some(before) = before { + let to_remove = before.next.take().unwrap(); + let to_remove = Box::into_raw(to_remove); + unsafe { + crate::compat::malloc::free(to_remove as *mut _); + } before.next = tail; } }