Skip to content
Permalink
Browse files

Fix memory leak in type parser

  • Loading branch information...
muglug committed Jun 29, 2019
1 parent 791b30a commit b9ec25483087eae1510b7409f9ffcae69de78d38
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/Psalm/Internal/Type/ParseTree.php
@@ -42,6 +42,15 @@ public function __destruct()
$this->parent = null;
}
public function cleanParents() : void
{
foreach ($this->children as $child) {
$child->cleanParents();
}
$this->parent = null;
}
/**
* Create a parse tree from a tokenised type
*
@@ -544,6 +553,8 @@ public static function createFromTokens(array $type_tokens)
}
}
$parse_tree->cleanParents();
if ($current_leaf !== $parse_tree
&& ($parse_tree instanceof ParseTree\GenericTree
|| $parse_tree instanceof ParseTree\CallableTree

0 comments on commit b9ec254

Please sign in to comment.
You can’t perform that action at this time.