mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 06:07:20 +08:00 
			
		
		
		
	fix: Object pointer not deleted (#662)
* fix: Object pointer not deleted * codes/cpp/chapter_hashing Signed-off-by: yishangzhang <zhangyi2017@cug.edu.cn> * Update hash_map_chaining.cpp --------- Signed-off-by: yishangzhang <zhangyi2017@cug.edu.cn> Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
		@ -92,6 +92,8 @@ class HashMapChaining {
 | 
				
			|||||||
        for (auto &bucket : bucketsTmp) {
 | 
					        for (auto &bucket : bucketsTmp) {
 | 
				
			||||||
            for (Pair *pair : bucket) {
 | 
					            for (Pair *pair : bucket) {
 | 
				
			||||||
                put(pair->key, pair->val);
 | 
					                put(pair->key, pair->val);
 | 
				
			||||||
 | 
					                // 释放内存
 | 
				
			||||||
 | 
					                delete pair;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user