From 55d287bc9d566dd0cf0cfe9633af88bca7c20d5c Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Mon, 18 Sep 2017 19:47:52 +0200 Subject: [PATCH] Issue #597 - Free the 'node' not stacked, and add 'message' --- src/parser.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index 56660aa..168823c 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1361,9 +1361,16 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode) if (nodeIsA(element)) { + TY_(Report)(doc, element, node, MISSING_ENDTAG_BEFORE); TY_(UngetToken)( doc ); } - TY_(Report)(doc, element, node, MISSING_ENDTAG_BEFORE); + else + { + /* Issue #597 - if we not 'UngetToken' then it is being discarded. + Add message, and 'FreeNode' - thanks @ralfjunker */ + TY_(Report)(doc, element, node, DISCARDING_UNEXPECTED); + TY_(FreeNode)(doc, node); + } if (!(mode & Preformatted)) TrimSpaces(doc, element);