diff --git a/src/mongo/scripting/mozjs/shell/jsthread.cpp b/src/mongo/scripting/mozjs/shell/jsthread.cpp index 0f319e52529..8d3bdf86a99 100644 --- a/src/mongo/scripting/mozjs/shell/jsthread.cpp +++ b/src/mongo/scripting/mozjs/shell/jsthread.cpp @@ -121,7 +121,7 @@ public: uasserted(ErrorCodes::JSInterpreterFailure, "Failed to JS::NewArrayObject"); } - _sharedData->_args = ObjectWrapper(cx, robj).toBSON(); + _sharedData->_args = ObjectWrapper(cx, robj).toBSON().getOwned(); _sharedData->_stack = currentJSStackToString(cx);