mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
Scope: pop_scope() returns IntrusivePtr<>
Make sure unused scopes are freed to fix memory leaks. The comment inside pop_scope() is now obsolete and I deleted it, because this commit implements the real solution. Note that this requires us to add a reference to the push_existing_scope() call in dbg_eval_expr(), because it never owned the reference.
This commit is contained in:
parent
8ea1d89529
commit
875bfc09a2
5 changed files with 13 additions and 9 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "Val.h"
|
||||
#include "Expr.h"
|
||||
#include "Func.h"
|
||||
#include "IntrusivePtr.h"
|
||||
#include "Stmt.h"
|
||||
#include "Scope.h"
|
||||
#include "Reporter.h"
|
||||
|
@ -468,7 +469,7 @@ TraversalCode OuterIDBindingFinder::PostExpr(const Expr* expr)
|
|||
|
||||
void end_func(IntrusivePtr<Stmt> body)
|
||||
{
|
||||
auto ingredients = std::make_unique<function_ingredients>(pop_scope(), body.release());
|
||||
auto ingredients = std::make_unique<function_ingredients>(pop_scope().release(), body.release());
|
||||
|
||||
if ( streq(ingredients->id->Name(), "anonymous-function") )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue