Skip to content

Commit 0d721bf

Browse files
committed
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
1 parent f49f967 commit 0d721bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/pool/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,16 @@ impl<T> Pool<T> {
359359
() => {
360360
if let Some(p) = Ptr::new(p as *mut _) {
361361
self.stack.push(p);
362+
n += 1;
362363
}
363364
}
364365

365366
#[cfg(not(target_arch = "x86_64"))]
366367
() => {
367368
self.stack.push(unsafe { Ptr::new_unchecked(p as *mut _) });
369+
n += 1;
368370
}
369371
}
370-
n += 1;
371372

372373
p = unsafe { p.add(sz) };
373374
len -= sz;

0 commit comments

Comments
 (0)