W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1999

BUG: Leak found in HTTmpAnchor

From: Andy Levine <andyl@infospinner.com>
Date: Fri, 10 Dec 1999 19:05:32 -0600
To: <www-lib@w3.org>
Message-ID: <006401bf4373$d2cbb9d0$0301a8c0@dolphin.infospinner.com>
I found a memory leak in the function HTTmpAnchor, file HTHome.c.

Because of where the return statement (line 162), the variables result,
tmpfile, and tmpurl never get HT_FREE'ed on a valid creation. On an invalid
creation, tmpfile and tmpurl WILL get freed.

Quick easy fix is to store the return HTParentAnchor* in a local, store the
result of HTAnchor_parent() into it, and fall through returning the stored

I additionally found that calling HTTmpAnchor repeatedly without freeing the
newly allocated anchor will cause the anchor hash table to continue to grow.
While this is not a bug, it would be nice to document.

Andy Levine
Received on Friday, 10 December 1999 20:05:53 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:52 UTC