Index: test/cctest/test-weakmaps.cc |
diff --git a/test/cctest/test-weakmaps.cc b/test/cctest/test-weakmaps.cc |
index 369dae5e999f91205b5e877283cd318b9e09ee6d..2684deb4158efba23712c73c90be81d80cd857bb 100644 |
--- a/test/cctest/test-weakmaps.cc |
+++ b/test/cctest/test-weakmaps.cc |
@@ -46,10 +46,12 @@ static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) { |
Handle<Map> map = factory->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); |
Handle<JSObject> weakmap_obj = factory->NewJSObjectFromMap(map); |
Handle<JSWeakMap> weakmap(JSWeakMap::cast(*weakmap_obj)); |
- // Do not use handles for the hash table, it would make entries strong. |
- Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 1); |
- weakmap->set_table(*table); |
- weakmap->set_next(Smi::FromInt(0)); |
+ // Do not leak handles for the hash table, it would make entries strong. |
+ { |
+ HandleScope scope(isolate); |
+ Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 1); |
+ weakmap->set_table(*table); |
+ } |
return weakmap; |
} |