mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Fix reference counting issues related to lambdas/closures
For example, circular references between a lambda function the frame it's stored within and/or its closure could cause memory leaks. This also fixes other various reference-count ownership issues that could lead to memory errors. There may still be some potential/undiscovered issues because the "outer ID" finding logic doesn't look quite right as the AST traversal descends within nested lambdas and considers their locals as "outer", but possibly the other logic for locating values in closures or cloning closures just works around that behavior.
This commit is contained in:
parent
0fe2a14d98
commit
44d922c4b5
11 changed files with 283 additions and 78 deletions
|
@ -26,11 +26,6 @@ extern void begin_func(ID* id, const char* module_name, function_flavor flavor,
|
|||
int is_redef, FuncType* t, attr_list* attrs = nullptr);
|
||||
extern void end_func(Stmt* body);
|
||||
|
||||
// Gathers all of the information from a scope and a function body needed to
|
||||
// build a function and collects it into a function_ingredients struct.
|
||||
// Gathered elements are not refeed.
|
||||
extern std::unique_ptr<function_ingredients> gather_function_ingredients(Scope* scope, Stmt* body);
|
||||
|
||||
// Gather all IDs referenced inside a body that aren't part of a given scope.
|
||||
extern id_list gather_outer_ids(Scope* scope, Stmt* body);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue