Plug leaks in SynthFS::remove_file().

The process spawn stress test can now run forever. :^)
This commit is contained in:
Andreas Kling 2018-12-28 03:09:45 +01:00
parent 3f3535213b
commit ab72666f48
Notes: sideshowbarker 2024-07-19 16:06:55 +09:00
3 changed files with 39 additions and 2 deletions

View file

@ -116,8 +116,12 @@ bool SynthFS::remove_file(InodeIndex inode)
break;
}
Vector<InodeIndex> indices_to_remove;
indices_to_remove.ensureCapacity(file.m_children.size());
for (auto& child : file.m_children)
remove_file(child->m_metadata.inode.index());
indices_to_remove.unchecked_append(child->m_metadata.inode.index());
for (auto& index : indices_to_remove)
remove_file(index);
m_inodes.remove(inode);
return true;
}