diff --git a/lib/src/query.c b/lib/src/query.c index f0f02822..f42e6c77 100644 --- a/lib/src/query.c +++ b/lib/src/query.c @@ -2291,12 +2291,9 @@ static TSQueryError ts_query__parse_pattern( is_immediate, &field_capture_quantifiers ); - if (e == PARENT_DONE) { - capture_quantifiers_delete(&field_capture_quantifiers); - return TSQueryErrorSyntax; - } if (e) { capture_quantifiers_delete(&field_capture_quantifiers); + if (e == PARENT_DONE) e = TSQueryErrorSyntax; return e; }