Re: [xml] libxml2: xmlNewChield and memory control
- From: Daniel Veillard <veillard redhat com>
- To: Stefan Schulze Frielinghaus <stefan seekline net>
- Cc: xml gnome org
- Subject: Re: [xml] libxml2: xmlNewChield and memory control
- Date: Tue, 13 Nov 2007 19:18:22 -0500
On Tue, Nov 13, 2007 at 06:58:41PM +0000, Stefan Schulze Frielinghaus wrote:
Hi,
I'm pretty new to libxml2 (2.6.29) and have therefor a question about
memory handling. When I add a new child to a tree e.g.
xmlNewChild(root_node, NULL, BAD_CAST "test", BAD_CAST testcontent);
Does the function xmlNewChild copy the content "testcontent" to a new
buffer? So that a free(testcontent) is safe.
xmlNodePtr
xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
const xmlChar *name, const xmlChar *content);
the values of name and content are not used as is, they are copied
internally. If you dynamically allocated content then its your responsability
to free it.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]