Skip to content

Commit 9260050

Browse files
committed
fix(scanner): correct UB when deleting old tag Tags
1 parent 2f80db3 commit 9260050

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/scanner.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ static bool scan_self_closing_tag_delimiter(Scanner *scanner, TSLexer *lexer) {
294294
if (lexer->lookahead == '>') {
295295
advance(lexer);
296296
if (scanner->tags.size > 0) {
297-
tag_free(&array_pop(&scanner->tags));
297+
Tag last_tag = array_pop(&scanner->tags);
298+
tag_free(&last_tag);
298299
lexer->result_symbol = SELF_CLOSING_TAG_DELIMITER;
299300
}
300301
return true;

0 commit comments

Comments
 (0)