[ox/std] Fix memory leak in Vector
This commit is contained in:
parent
f624c720f9
commit
bec75d2eba
2
deps/ox/src/ox/std/vector.hpp
vendored
2
deps/ox/src/ox/std/vector.hpp
vendored
@ -85,6 +85,8 @@ struct VectorAllocator {
|
|||||||
constexpr void deallocate(T *items, std::size_t cap) noexcept {
|
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
|
// small vector optimization cannot be done it constexpr, but it doesn't really matter in constexpr
|
||||||
if (std::is_constant_evaluated()) {
|
if (std::is_constant_evaluated()) {
|
||||||
|
Allocator{}.deallocate(items, cap);
|
||||||
|
} else {
|
||||||
if (items && static_cast<void*>(items) != static_cast<void*>(m_data.data())) {
|
if (items && static_cast<void*>(items) != static_cast<void*>(m_data.data())) {
|
||||||
Allocator{}.deallocate(items, cap);
|
Allocator{}.deallocate(items, cap);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user