RE: How can I free externally allocated buffers ?

"Paul Keogh" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
> I'm trying to use libXML for XML parsing, but some of the functions
> there allocate memory for me (char* strings) and require me to free
> them. but calling gw_free() on memory not allocated with gw_malloc()
> will cause a panic, and I cannot call free() directly.
> 
> Is there a simple way to solve this problem ?

libxml has its own set of memory wrappers. Use them, I guess.

From xmlmemory.h;

/*
 * The XML memory wrapper support 4 basic overloadable functions
 */
typedef void (*xmlFreeFunc)(void *);
typedef void *(*xmlMallocFunc)(int);
typedef void *(*xmlReallocFunc)(void *, int);
typedef char *(*xmlStrdupFunc)(const char *);
winmail.dat (application/ms-tnef, 1.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.