Re: [xml] Freeing Input buffer after DTD parse

On Thu, Jul 05, 2001 at 12:07:33AM +0000, Matt Sergeant wrote:

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.

  I think it is freed by the routine called to parse the DTD, it allocates
a parser context, push the input on the stack, and the input is freed when
the stack is freed with the parser context.

  Agreed it's better when allocs/frees are made at the same level, in this
case one would have to flag the input as user provided or pop it from the
stack before freeing the parser context. First solution is doable but annoying
second is possible too but in both cases that would change the API in
practice. Maybe adding that the input will be consumed and shouldn't be
freed to the doc is simpler.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine
Sep 17-18 2001 Brussels Red Hat TechWorld

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