AK: Fix off-by-one in Vector::prepend(Vector&&).

Caught by valgrind's uninitialized access checks on the Vector unit test.
Yay for finding bugs with valgrind on the unit tests! :^)
This commit is contained in:
Andreas Kling 2019-07-21 12:51:54 +02:00
parent 20c6edc976
commit 29a62558c4
Notes: sideshowbarker 2024-07-19 13:06:22 +09:00

View file

@ -362,7 +362,7 @@ public:
auto other_size = other.size();
grow_capacity(size() + other_size);
for (int i = size() + other_size - 1; i > other.size(); --i) {
for (int i = size() + other_size - 1; i >= other.size(); --i) {
new (slot(i)) T(move(at(i - other_size)));
at(i - other_size).~T();
}