summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/mozjs/numberlong.cpp
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2017-03-15 16:43:49 -0400
committerAndrew Morrow <acm@mongodb.com>2017-04-09 15:09:43 -0400
commitbe3d66e78ccbf8e9cb96f1a7b1c270d84fab9b8a (patch)
treed91e2bd9266a53faf3652f8ca6c93508e9027a8b /src/mongo/scripting/mozjs/numberlong.cpp
parent51a9e2738ad3f91c94e203c7e9b8872de90c6d4c (diff)
downloadmongo-be3d66e78ccbf8e9cb96f1a7b1c270d84fab9b8a.tar.gz
SERVER-22520 Improve ASAN MozJS integration
ASAN has trouble dealing with the heap allocations SpiderMonkey produces, due to the storage format of those pointers (tagged punbox'd types). Keeping a side std::unordered_set<void*> which tracks allocations provides the reachability ASAN needs for a little bit of extra book keeping. (cherry picked from commit 96f0fbd7911533fd4279742d81cf53b198d71b03)
Diffstat (limited to 'src/mongo/scripting/mozjs/numberlong.cpp')
-rw-r--r--src/mongo/scripting/mozjs/numberlong.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/scripting/mozjs/numberlong.cpp b/src/mongo/scripting/mozjs/numberlong.cpp
index 7ac68adec3c..d211ed44081 100644
--- a/src/mongo/scripting/mozjs/numberlong.cpp
+++ b/src/mongo/scripting/mozjs/numberlong.cpp
@@ -59,7 +59,7 @@ void NumberLongInfo::finalize(JSFreeOp* fop, JSObject* obj) {
auto numLong = static_cast<int64_t*>(JS_GetPrivate(obj));
if (numLong)
- delete numLong;
+ getScope(fop)->trackedDelete(numLong);
}
int64_t NumberLongInfo::ToNumberLong(JSContext* cx, JS::HandleValue thisv) {
@@ -190,7 +190,7 @@ void NumberLongInfo::construct(JSContext* cx, JS::CallArgs args) {
numLong = (top << 32) + bot;
}
- JS_SetPrivate(thisv, new int64_t(numLong));
+ JS_SetPrivate(thisv, scope->trackedNew<int64_t>(numLong));
args.rval().setObjectOrNull(thisv);
}