From 4377ab84a4a2748d72be91d26210567cc933c760 Mon Sep 17 00:00:00 2001 From: lutianxiong Date: Sat, 20 Jun 2020 09:19:17 +0800 Subject: [PATCH] fix memleak in GetTokenFromStream check asp & php if ParseAttribute return NULL --- src/lexer.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lexer.c b/src/lexer.c index ca66aee..bbc1e15 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -3263,6 +3263,22 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode ) if (!name) { + /* check if attributes are created by ASP markup */ + if (asp) + { + av = TY_(NewAttribute)(doc); + av->asp = asp; + AddAttrToList( &attributes, av ); + } + + /* check if attributes are created by PHP markup */ + if (php) + { + av = TY_(NewAttribute)(doc); + av->php = php; + AddAttrToList( &attributes, av ); + } + /* fix for http://tidy.sf.net/bug/788031 */ lexer->lexsize -= 1; lexer->txtend = lexer->txtstart;