Skip to content

Commit

Permalink
Merge pull request #13 from hyrise/mrcl/fix_undefined_behavior_dealloc
Browse files Browse the repository at this point in the history
Deallocate m_mem only if not nullptr
  • Loading branch information
gmarcais authored Jan 27, 2025
2 parents 4a490bc + ad3a8a0 commit eb83803
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/compact_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ class vector {
: vector(0, 0, allocator)
{ }
~vector() {
m_allocator.deallocate(m_mem, elements_to_words(m_capacity, bits()));
if (m_mem) {
m_allocator.deallocate(m_mem, elements_to_words(m_capacity, bits()));
}
}

vector& operator=(const vector& rhs) {
Expand Down

0 comments on commit eb83803

Please sign in to comment.