Fix leaked lookahead trees in normal parsing
This commit is contained in:
parent
a74bf7ece1
commit
7c44b0e387
7 changed files with 85 additions and 36 deletions
|
|
@ -76,6 +76,8 @@ void ts_tree_assign_parents(TSTree *self) {
|
|||
}
|
||||
|
||||
void ts_tree_set_children(TSTree *self, size_t child_count, TSTree **children) {
|
||||
if (self->child_count > 0)
|
||||
ts_free(self->children);
|
||||
self->children = children;
|
||||
self->child_count = child_count;
|
||||
self->named_child_count = 0;
|
||||
|
|
@ -131,6 +133,8 @@ void ts_tree_retain(TSTree *self) {
|
|||
}
|
||||
|
||||
void ts_tree_release(TSTree *self) {
|
||||
if (!self)
|
||||
return;
|
||||
assert(self->ref_count > 0);
|
||||
self->ref_count--;
|
||||
if (self->ref_count == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue