Merge pull request #1938 from panicinc/merge/parse-cancel-pointer-crash

Resolving a crash when freeing a null pointer when cancelling parses
This commit is contained in:
Max Brunsfeld 2022-10-31 13:00:20 -07:00 committed by GitHub
commit 757c032455
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1461,7 +1461,9 @@ static bool ts_parser__advance(
((self->cancellation_flag && atomic_load(self->cancellation_flag)) ||
(!clock_is_null(self->end_clock) && clock_is_gt(clock_now(), self->end_clock)))
) {
ts_subtree_release(&self->tree_pool, lookahead);
if (lookahead.ptr) {
ts_subtree_release(&self->tree_pool, lookahead);
}
return false;
}