Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
liss-h committed Jan 14, 2025
1 parent 2df38f2 commit 8584915
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/dice/sparse-map/sparse_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,10 +762,16 @@ class sparse_array {
static void destroy_and_deallocate_values(
allocator_type &alloc, pointer values, size_type nb_values,
size_type capacity_values) noexcept {
if (capacity_values == 0) {
tsl_sh_assert(nb_values == 0);
// nothing to deallocate
// alloc.deallocate(nullptr, 0) is invalid
return;
}

for (size_type i = 0; i < nb_values; i++) {
destroy_value(alloc, values + i);
}

alloc.deallocate(values, capacity_values);
}

Expand Down

0 comments on commit 8584915

Please sign in to comment.