[ox/std] Fix memory leak in Vector

This commit is contained in:
Gary Talent 2024-05-09 23:12:36 -05:00
parent f624c720f9
commit bec75d2eba

View File

@ -85,6 +85,8 @@ struct VectorAllocator {
constexpr void deallocate(T *items, std::size_t cap) noexcept {
// small vector optimization cannot be done it constexpr, but it doesn't really matter in constexpr
if (std::is_constant_evaluated()) {
Allocator{}.deallocate(items, cap);
} else {
if (items && static_cast<void*>(items) != static_cast<void*>(m_data.data())) {
Allocator{}.deallocate(items, cap);
}