diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index 69df11c9ee4..f1e43397e28 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -277,6 +277,7 @@ KResult TmpFSInode::add_child(Inode& child, StringView const& name, mode_t) return ENAMETOOLONG; auto name_kstring = TRY(KString::try_create(name)); + // Balanced by `delete` in remove_child() auto* child_entry = new (nothrow) Child { move(name_kstring), static_cast(child) }; if (!child_entry) return ENOMEM; @@ -303,6 +304,8 @@ KResult TmpFSInode::remove_child(StringView const& name) child->inode->did_delete_self(); m_children.remove(*child); did_remove_child(child_id, name); + // Balanced by `new` in add_child() + delete child; return KSuccess; }