From fc63e990c8aa681954569a7e249738348876761f Mon Sep 17 00:00:00 2001 From: yishangzhang Date: Sat, 29 Jul 2023 02:08:00 +0800 Subject: [PATCH] fix: Object pointer not deleted (#662) * fix: Object pointer not deleted * codes/cpp/chapter_hashing Signed-off-by: yishangzhang * Update hash_map_chaining.cpp --------- Signed-off-by: yishangzhang Co-authored-by: Yudong Jin --- codes/cpp/chapter_hashing/hash_map_chaining.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codes/cpp/chapter_hashing/hash_map_chaining.cpp b/codes/cpp/chapter_hashing/hash_map_chaining.cpp index 17ca744cc..ef8fc11d5 100644 --- a/codes/cpp/chapter_hashing/hash_map_chaining.cpp +++ b/codes/cpp/chapter_hashing/hash_map_chaining.cpp @@ -92,6 +92,8 @@ class HashMapChaining { for (auto &bucket : bucketsTmp) { for (Pair *pair : bucket) { put(pair->key, pair->val); + // ι‡Šζ”Ύε†…ε­˜ + delete pair; } } }