mirror of
https://github.com/krahets/hello-algo.git
synced 2026-10-22 05:55:18 +08:00
fix: Object pointer not deleted (#662)
* fix: Object pointer not deleted * codes/cpp/chapter_hashing Signed-off-by: yishangzhang <[email protected]> * Update hash_map_chaining.cpp --------- Signed-off-by: yishangzhang <[email protected]> Co-authored-by: Yudong Jin <[email protected]>
This commit is contained in:
co-authored by
Yudong Jin
parent
35e9c8c209
commit
fc63e990c8
@@ -92,6 +92,8 @@ class HashMapChaining {
|
||||
for (auto &bucket : bucketsTmp) {
|
||||
for (Pair *pair : bucket) {
|
||||
put(pair->key, pair->val);
|
||||
// 释放内存
|
||||
delete pair;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user