mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-02 14:54:30 +00:00
fix return value of Pool::grow
on x86_64
the logic was increasing the "capacity" counter even in the case the given memory address was out of range (ANCHOR +- 2GB) -- `None` branch in code -- resulting in a wrong / misleading value being reported
This commit is contained in:
parent
f49f967148
commit
0d721bf0e6
@ -359,15 +359,16 @@ impl<T> Pool<T> {
|
|||||||
() => {
|
() => {
|
||||||
if let Some(p) = Ptr::new(p as *mut _) {
|
if let Some(p) = Ptr::new(p as *mut _) {
|
||||||
self.stack.push(p);
|
self.stack.push(p);
|
||||||
|
n += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "x86_64"))]
|
#[cfg(not(target_arch = "x86_64"))]
|
||||||
() => {
|
() => {
|
||||||
self.stack.push(unsafe { Ptr::new_unchecked(p as *mut _) });
|
self.stack.push(unsafe { Ptr::new_unchecked(p as *mut _) });
|
||||||
}
|
|
||||||
}
|
|
||||||
n += 1;
|
n += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p = unsafe { p.add(sz) };
|
p = unsafe { p.add(sz) };
|
||||||
len -= sz;
|
len -= sz;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user