mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix IntrusivePtr release leaks in reaching-def logic
This commit is contained in:
parent
6c80052c55
commit
aa03e54ba0
2 changed files with 5 additions and 13 deletions
|
@ -75,7 +75,6 @@ public:
|
||||||
auto empty_rds = make_intrusive<ReachingDefs>();
|
auto empty_rds = make_intrusive<ReachingDefs>();
|
||||||
SetPreMinRDs(o, empty_rds);
|
SetPreMinRDs(o, empty_rds);
|
||||||
SetPreMaxRDs(o, empty_rds);
|
SetPreMaxRDs(o, empty_rds);
|
||||||
empty_rds.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inherit a node's pre-RDs from those of another node.
|
// Inherit a node's pre-RDs from those of another node.
|
||||||
|
|
|
@ -392,9 +392,7 @@ void RD_Decorate::TraverseSwitch(const SwitchStmt* sw)
|
||||||
// an empty RD.
|
// an empty RD.
|
||||||
sw_post_min_rds = make_intrusive<ReachingDefs>();
|
sw_post_min_rds = make_intrusive<ReachingDefs>();
|
||||||
|
|
||||||
mgr.SetPostRDs(sw, sw_post_min_rds, sw_post_max_rds);
|
mgr.SetPostRDs(sw, std::move(sw_post_min_rds), std::move(sw_post_max_rds));
|
||||||
sw_post_min_rds.release();
|
|
||||||
sw_post_max_rds.release();
|
|
||||||
|
|
||||||
block_defs.pop_back();
|
block_defs.pop_back();
|
||||||
}
|
}
|
||||||
|
@ -409,9 +407,7 @@ void RD_Decorate::DoIfStmtConfluence(const IfStmt* i)
|
||||||
auto max_else_branch_rd = mgr.GetPostMaxRDs(i->FalseBranch());
|
auto max_else_branch_rd = mgr.GetPostMaxRDs(i->FalseBranch());
|
||||||
auto max_post_rds = max_if_branch_rd->Union(max_else_branch_rd);
|
auto max_post_rds = max_if_branch_rd->Union(max_else_branch_rd);
|
||||||
|
|
||||||
mgr.SetPostRDs(i, min_post_rds, max_post_rds);
|
mgr.SetPostRDs(i, std::move(min_post_rds), std::move(max_post_rds));
|
||||||
min_post_rds.release();
|
|
||||||
max_post_rds.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RD_Decorate::DoLoopConfluence(const Stmt* s, const Stmt* top,
|
void RD_Decorate::DoLoopConfluence(const Stmt* s, const Stmt* top,
|
||||||
|
@ -478,10 +474,8 @@ void RD_Decorate::DoLoopConfluence(const Stmt* s, const Stmt* top,
|
||||||
// of whether the loop body has flow reaching the end of it,
|
// of whether the loop body has flow reaching the end of it,
|
||||||
// since an internal "next" can still cause definitions to
|
// since an internal "next" can still cause definitions to
|
||||||
// propagate to the beginning.
|
// propagate to the beginning.
|
||||||
auto min_post_rds = s_min_pre->IntersectWithConsolidation(loop_min_post,
|
auto min_post_rds = s_min_pre->IntersectWithConsolidation(loop_min_post, ds);
|
||||||
ds);
|
mgr.SetPostMinRDs(s, std::move(min_post_rds));
|
||||||
mgr.SetPostMinRDs(s, min_post_rds);
|
|
||||||
min_post_rds.release();
|
|
||||||
|
|
||||||
// Note, we use ignore_break=true because what we care about is not
|
// Note, we use ignore_break=true because what we care about is not
|
||||||
// whether flow goes just beyond the last statement of the body,
|
// whether flow goes just beyond the last statement of the body,
|
||||||
|
@ -492,8 +486,7 @@ void RD_Decorate::DoLoopConfluence(const Stmt* s, const Stmt* top,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto max_post_rds = s_max_pre->Union(loop_max_post);
|
auto max_post_rds = s_max_pre->Union(loop_max_post);
|
||||||
mgr.SetPostMaxRDs(s, max_post_rds);
|
mgr.SetPostMaxRDs(s, std::move(max_post_rds));
|
||||||
max_post_rds.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue