Tidy memory leakage and crashes (fwd)

---------- Forwarded message ----------
Date: Wed, 06 Jun 2001 19:50:35 -0700
From: Patrick Lok <plok@inktomi.com>
To: Dave Raggett <dsr@w3.org>
Subject: Tidy memory leakage and crashes

Dear Mr. Raggett,

Looks like that tidy leaks memory in parser.c in some places where 
ReportWarning(lexer, element, node, DISCARDING_UNEXPECTED) got called.

ReportWarning with DISCARDING_UNEXPECTED was called in parser.c without 
being followed by a FreeNode at lines: 493, 728, 1329, 1501,1557, 1699, 
1752, 1900, 1938, 1982, 2024, 2107, 2257, 2281, 3244, 3410.
I hope the list would ease your way to find out where to add the FreeNode 
function call.

At parser.c:1100, a new "br" node was created by calling InferredTag but 
"continue" was immediately followed (memory leak). According to the 
comment, InsertNodeAtEnd should be inserted in between, am I right?

At parser.c:3075, a new <body> node is created by calling InferredTag but 
without inserting it to the tree (memory leak) "return" is called. Do you 
mean "break" instead of "return"?

The call to the function InsertNodeAfterElement at parser.c:1473 would 
crashes tidy if and empty <center> (<center></center>) exist under a <dl>. 
Since the empty <center> node would be removed and inserting a <dl> node 
after it would cause a seg fault.

I've implemented "fix" for all the problems above, except the one at 
parser.c:3075. But I would prefer an official fix from you and anyone 
involve in the tidy project,

Thanks a lot,
Patrick

Received on Monday, 11 June 2001 04:57:37 UTC