aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-27 07:58:10 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-27 07:58:10 -0800
commit706406af48aa43e218d9428761acfd1b64ec5be4 (patch)
treee4409a40caefe7348ba1e1da779972f4ed6fcf33
parent39493e5d944bd627f79889be85a131cc349238db (diff)
downloadbun-706406af48aa43e218d9428761acfd1b64ec5be4.tar.gz
bun-706406af48aa43e218d9428761acfd1b64ec5be4.tar.zst
bun-706406af48aa43e218d9428761acfd1b64ec5be4.zip
remove leak
-rw-r--r--src/bun.js/bindings/bindings.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp
index 4c65cedf5..f6cb879bf 100644
--- a/src/bun.js/bindings/bindings.cpp
+++ b/src/bun.js/bindings/bindings.cpp
@@ -3755,6 +3755,8 @@ void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* g
}
}
+ auto* clientData = WebCore::clientData(vm);
+
if (fast) {
bool anyHits = false;
@@ -3769,11 +3771,13 @@ void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* g
}
// ignore constructor
- if (entry.key() == vm.propertyNames->constructor) {
+ if (entry.key() == vm.propertyNames->constructor)
return true;
- }
}
+ if (clientData->builtinNames().bunNativePtrPrivateName() == entry.key())
+ return true;
+
ZigString key = toZigString(entry.key());
JSC::JSValue propertyValue = object->getDirect(entry.offset());
@@ -3815,13 +3819,12 @@ void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* g
RETURN_IF_EXCEPTION(scope, void());
for (auto& property : properties) {
- if (UNLIKELY(property.isEmpty() || property.isNull()))
+ if (UNLIKELY(property.isEmpty() || property.isNull() || property.isPrivateName()))
continue;
// ignore constructor
- if (property == vm.propertyNames->constructor) {
+ if (property == vm.propertyNames->constructor || clientData->builtinNames().bunNativePtrPrivateName() == property)
continue;
- }
JSC::PropertySlot slot(object, PropertySlot::InternalMethodType::Get);
if (!object->getPropertySlot(globalObject, property, slot))