Skip to content

Commit

Permalink
fix potential stack overflow in Profile.jl (JuliaLang#31693)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Apr 12, 2019
1 parent 1aa8c68 commit 6308ebd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,13 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
end
end
function cleanup!(node::StackFrameTree)
empty!(node.builder_key)
empty!(node.builder_value)
foreach(cleanup!, values(node.down))
stack = StackFrameTree[node]
while !isempty(stack)
node = pop!(stack)
empty!(node.builder_key)
empty!(node.builder_value)
append!(stack, values(node.down))
end
nothing
end
cleanup!(root)
Expand Down

0 comments on commit 6308ebd

Please sign in to comment.