diff --git a/esp-alloc/CHANGELOG.md b/esp-alloc/CHANGELOG.md index b9aacdc8e..e2d994a7f 100644 --- a/esp-alloc/CHANGELOG.md +++ b/esp-alloc/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fix problem of not de-allocating memory in some situations (#3949) ### Removed diff --git a/esp-alloc/src/allocators.rs b/esp-alloc/src/allocators.rs index 51553ba57..0441733b3 100644 --- a/esp-alloc/src/allocators.rs +++ b/esp-alloc/src/allocators.rs @@ -30,7 +30,7 @@ unsafe impl Allocator for EspHeap { unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { unsafe { - crate::HEAP.dealloc(ptr.as_ptr(), layout); + self.dealloc(ptr.as_ptr(), layout); } } } @@ -45,7 +45,7 @@ unsafe impl CoreAllocator for EspHeap { unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { unsafe { - crate::HEAP.dealloc(ptr.as_ptr(), layout); + self.dealloc(ptr.as_ptr(), layout); } } }