Re: [xml] Curious Segmentation Fault

On Mon, Apr 05, 2004 at 11:45:39AM -0400, Anthony Carrico wrote:
On Mon, Apr 05, 2004 at 03:14:54AM -0400, Daniel Veillard wrote:
On Sun, Apr 04, 2004 at 11:33:05PM -0400, Anthony Carrico wrote:

  Because after element.unlinkNode(), the element still references
the document, and element.unlinkNode() checks it to find if the
strings from the element came from the document dictionary.
If you free the document after any element which references it you
don't have the problem. Allocation granularity in libxml2 is
at the document level.

So the third example (which seems to succed) is also illegal. Correct?
This one:

import libxml2
doc = libxml2.newDoc("1.0")
element = doc.newChild(None, "test", None)

  you free doc, element is linked to doc, you freed element underlying
data there.

doc = libxml2.newDoc("1.0")

  that should crash,  element underlying node has been freed.

Again, the main unit of memory allocation in libxml2 is the document.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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