RE: [xml] xmlAllocOutputBuffer allocates memory I can't free



Thanks heaps... I don't know how I missed that comment in the docs...

-Dominic

-----Original Message-----
From: Joachim Bauch [mailto:bauch struktur de] 
Sent: Thursday, 8 April 2004 7:36 PM
To: Dominic Eales
Cc: XML List
Subject: Re: [xml] xmlAllocOutputBuffer allocates memory I can't free


Hi,

Dominic Eales wrote:
I am using libxml 2.26 and I call the function 
xmlDocDumpFormatMemoryEnc
which
allocates some memory with the function xmlAllocOutputBuffer().

The problem is when I try to free this memory with the standard C
function free() the debugger
says that the memory was never allocated...

Why is that?

you should use the correct libxml2 API to free the allocated data, which
is "xmlFree" in this case:

http://xmlsoft.org/html/libxml-tree.html#xmlDocDumpFormatMemoryEnc

<quote>
Note it is up to the caller of this function to free the allocated
memory with xmlFree(). </quote>

Joachim



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