diff --git a/src/Debug.cc b/src/Debug.cc index 9f1a9b28b2..9f7b9f80ac 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -77,7 +77,7 @@ DebuggerState::DebuggerState() { BreakFromSignal(false); // ### Don't choose this arbitrary size! Extend Frame. - dbg_locals = new Frame(1024, /* func = */ nullptr, /* fn_args = */ nullptr); + dbg_locals = detail::MakeFrame(1024, /* func = */ nullptr, /* fn_args = */ nullptr).release(); } DebuggerState::~DebuggerState() { Unref(dbg_locals); } diff --git a/src/Func.cc b/src/Func.cc index 0fa151581d..a29ba27f39 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -331,7 +331,7 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const { return Flavor() == FUNC_FLAVOR_HOOK ? val_mgr->True() : nullptr; } - auto f = make_intrusive(frame_size, this, args); + auto f = detail::MakeFrame(frame_size, this, args); // Hand down any trigger. if ( parent ) { @@ -468,9 +468,9 @@ void ScriptFunc::CreateCaptures(Frame* f) { if ( bodies[0].stmts->Tag() == STMT_ZAM ) captures_vec = std::make_unique>(); else { - delete captures_frame; + Unref(captures_frame); delete captures_offset_mapping; - captures_frame = new Frame(captures->size(), this, nullptr); + captures_frame = detail::MakeFrame(captures->size(), this, nullptr).release(); captures_offset_mapping = new OffsetMap; } @@ -528,7 +528,7 @@ void ScriptFunc::SetCaptures(Frame* f) { const auto& captures = type->GetCaptures(); ASSERT(captures); - delete captures_frame; + Unref(captures_frame); delete captures_offset_mapping; captures_frame = f; captures_offset_mapping = new OffsetMap; @@ -655,7 +655,7 @@ std::optional ScriptFunc::SerializeCaptures() const { auto& cv = *captures_vec; auto& captures = *type->GetCaptures(); int n = captures_vec->size(); - auto temp_frame = make_intrusive(n, this, nullptr); + auto temp_frame = detail::MakeFrame(n, this, nullptr); for ( int i = 0; i < n; ++i ) { auto c_i = cv[i].ToVal(captures[i].Id()->GetType()); diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index 446ff82215..e168a267c9 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -1066,11 +1066,11 @@ SetupResult setup(int argc, char** argv, Options* zopts) { if ( stmts ) { auto [body, scope] = get_global_stmts(); StmtFlowType flow; - Frame f(scope->Length(), nullptr, nullptr); - g_frame_stack.push_back(&f); + auto f = detail::MakeFrame(scope->Length(), nullptr, nullptr); + g_frame_stack.push_back(f.get()); try { - body->Exec(&f, flow); + body->Exec(f.get(), flow); } catch ( InterpreterException& ) { reporter->FatalError("failed to execute script statements at top-level scope"); }