forked from M-Labs/zynq-rs
libsupport_zynq/ram: check ptr range for deallocation
This commit is contained in:
parent
157439bc88
commit
a116142f63
@ -34,7 +34,10 @@ unsafe impl GlobalAlloc for CortexA9Alloc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
||||||
if cfg!(not(feature = "alloc_core")) || MPIDR.read().cpu_id() == 0 {
|
if cfg!(not(feature = "alloc_core"))
|
||||||
|
|| ((&__heap0_start as *const usize as usize <= ptr as usize)
|
||||||
|
&& ((ptr as usize) < &__heap0_end as *const usize as usize))
|
||||||
|
{
|
||||||
&self.0
|
&self.0
|
||||||
} else {
|
} else {
|
||||||
&self.1
|
&self.1
|
||||||
|
Loading…
Reference in New Issue
Block a user