Re: [xml] Freeing Input buffer after DTD parse

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.

  xmlParserInputBufferPush will make an internal copy since it's
an async processing I/O (xmlParserInputBufferCreateMem does a copy

  Maybe the leak is not due to the fact that xmlFreeParserInputBuffer
is missing (I think it's done internally).


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]