Re: [xml] Freeing Input buffer after DTD parse
- From: Matt Sergeant <matt sergeant org>
- To: veillard redhat com
- Cc: "xml gnome org" <xml gnome org>
- Subject: Re: [xml] Freeing Input buffer after DTD parse
- Date: 05 Jul 2001 00:07:33 +0000
On 04 Jul 2001 18:25:23 -0400, Daniel Veillard wrote:
On Fri, Jun 29, 2001 at 03:17:37PM +0100, Matt Sergeant wrote:
/* warn("make buffer\n"); */
buffer = xmlAllocParserInputBuffer(enc);
/* xmlParserInputBufferCreateMem(str, strlen(str), enc); */
xmlParserInputBufferPush(buffer, strlen(str), str);
/* warn("parse\n"); */
res = xmlIOParseDTD(NULL, buffer, enc);
/* warn("free : 0x%x\n", buffer); */
/* NOTE: For some reason freeing this InputBuffer causes a segfault! */
/* xmlFreeParserInputBuffer(buffer); */
Hum, why didn't you use xmlParserInputBufferCreateMem ?
My take on this is that xmlIOParseDTD frees the parser context
before returning and this includes the input buffer.
I was doing. It makes no difference which you use.
Maybe the leak is not due to the fact that xmlFreeParserInputBuffer
is missing (I think it's done internally).
I'm not saying there definitely is a leak without
xmlFreeParserInputBuffer, because I haven't tested it. But since the
buffer is malloc'd in xmlAllocParserInputBuffer(), it needs to be freed
somehow, and every way I try causes a segfault, either immediately, or
later on down the line.
Matt.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]