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
too).

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

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Sep 17-18 2001 Brussels Red Hat TechWorld http://www.redhat-techworld.com




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