Issue #186 - Move FreeLexer() to near last

This commit is contained in:
Geoff McLane 2015-03-19 19:14:27 +01:00
parent 12b0fc74a9
commit 3585d4c31a
2 changed files with 11 additions and 4 deletions

View file

@ -171,7 +171,6 @@ void tidyDocRelease( TidyDocImpl* doc )
doc->errout = NULL;
TY_(FreePrintBuf)( doc );
TY_(FreeLexer)( doc );
TY_(FreeNode)(doc, &doc->root);
TidyClearMemory(&doc->root, sizeof(Node));
@ -181,6 +180,11 @@ void tidyDocRelease( TidyDocImpl* doc )
TY_(FreeConfig)( doc );
TY_(FreeAttrTable)( doc );
TY_(FreeTags)( doc );
/*\
* Issue #186 - Now FreeNode depend on the doctype, so the lexer is needed
* to determine which hash is to be used, so free it last.
\*/
TY_(FreeLexer)( doc );
TidyDocFree( doc, doc );
}
}
@ -1182,7 +1186,6 @@ int TY_(DocParseStream)( TidyDocImpl* doc, StreamIn* in )
doc->docIn = in;
TY_(TakeConfigSnapshot)( doc ); /* Save config state */
TY_(FreeLexer)( doc );
TY_(FreeAnchors)( doc );
TY_(FreeNode)(doc, &doc->root);
@ -1190,7 +1193,11 @@ int TY_(DocParseStream)( TidyDocImpl* doc, StreamIn* in )
if (doc->givenDoctype)
TidyDocFree(doc, doc->givenDoctype);
/*\
* Issue #186 - Now FreeNode depend on the doctype, so the lexer is needed
* to determine which hash is to be used, so free it last.
\*/
TY_(FreeLexer)( doc );
doc->givenDoctype = NULL;
doc->lexer = TY_(NewLexer)( doc );

View file

@ -1 +1 @@
4.9.22
4.9.23