Skip to content

Commit

Permalink
fix memory leak in hashmap (oneapi-src#2811)
Browse files Browse the repository at this point in the history
  • Loading branch information
md-shafiul-alam authored Jun 20, 2024
1 parent b0a5a0e commit 580a776
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cpp/oneapi/dal/detail/hash_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ class hash_map {
}

~hash_map() {
for (std::int64_t i = 0; i < capacity_; i++) {
entry_ptr current = entries_[i];
while (current) {
entry_ptr next = current->get_next();
delete current;
current = next;
}
}
delete[] entries_;
entries_ = nullptr;
capacity_ = 0;
Expand Down

0 comments on commit 580a776

Please sign in to comment.