BUG: Leak found in HTTmpAnchor

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
value.

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.

Thanks
Andy Levine

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