#926 memory leak when xhtml in and html out

closed-out-of-date
nobody
5
2016-02-01
2010-01-21
Anonymous
No

Hi,
I am using tidy 1.46 and found that when I set tidyHtmlOut and the input page has a DocType node, I lost 80 bytes every time.
Is this a bug ?

And I thought may be this is the problem:

In tidylib.c, funtion tidyDocCleanAndRepair()

/* If we had XHTML input but want HTML output */
if ( htmlOut && doc->lexer->isvoyager )
{
Node* node = TY_(FindDocType)(doc);
/* Remove reference, but do not free */ //Why do not free? the node seems not be freed anywhere else and cause a memory leak
if (node)
TY_(RemoveNode)(node);
}

I modified like this:
/* If we had XHTML input but want HTML output */
if ( htmlOut && doc->lexer->isvoyager )
{
Node* node = TY_(FindDocType)(doc);
/* Remove reference, but do not free */ Why do not free?
if (node)
{
TY_(RemoveNode)(node);
TY_(FreeNode)(doc, node); //Add this line, no memory leak anymore
}
}

Discussion

  • Geoff

    Geoff - 2016-02-01

    Thanks for the report... now long ago... sorry for the delay...

    Tidy source has moved on to https://github.com/htacg/tidy-html5,
    site to http://www.html-tidy.org/

    Now the code you point to still exists in modern Tidy
    tidylib.c
    with the same comments to not free, so maybe a potential memory leak
    still exists!

    Anyway, meantime closing this as out-of-date...

    If you feel there is still a bug in modern tidy then please file an issue, and if you find, fix, and test the problem in a tidy fork then you can issue a Pull Request together with sample html and config used.

    Tidy needs your support...

     
  • Geoff

    Geoff - 2016-02-01
    • status: open --> closed-out-of-date
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks