Skip to content

Commit bb1959f

Browse files
Fix TypedArena infinitely looping when inplace reallocation fails.
1 parent 9e963b9 commit bb1959f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libarena/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ impl<T> TypedArena<T> {
196196
self.end.set(last_chunk.end());
197197
return;
198198
} else {
199-
let prev_capacity = last_chunk.storage.cap();
199+
new_capacity = last_chunk.storage.cap();
200200
loop {
201-
new_capacity = prev_capacity.checked_mul(2).unwrap();
201+
new_capacity = new_capacity.checked_mul(2).unwrap();
202202
if new_capacity >= currently_used_cap + n {
203203
break;
204204
}

0 commit comments

Comments
 (0)