Re: [xml] parent pointer



On Mon, Apr 30, 2012 at 10:53:31AM -0700, Zhigang Chen wrote:
Hi all

Occasionally, I have seen some nodes have its parent pointer set to -1. Also they seem to have been freed 
implicitly, because (1) freeing them explicitly would throw error, (2) not freeing them does not incur 
memory leaks as reported by xmlMemBlocks.

I am wondering where in the source code the parent pointer is set to -1, and why it's not set to 0.

  The only way this could happen is if you compile with memory debug and
then blocks which were allocated and then freed are overwritten with -1
to catch potential reuse after free errors

  see in xmlMemFree() / xmlmemory.c
  memset(target, -1, p->mh_size);

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]