Re: [xml] exception/segfault on xmlFreeDoc()



OK, I replaced the CreateLoadXMLDoc() call in LoadDocument() with the
follwoing and I still get the same crash.
And I find it a bit retarded I have to call
xmlTextReaderPreservePattern() with an empty pattern to get the
complete document from the xmlReader interface. If I don't call it I
get an empty document from xmlTextReaderCurrentDoc().
Please keep in mind I am still using 2.6.5. I can't switch to 2.6.7
right now, but will next week.

        xmlTextReaderPtr reader = xmlReaderForFile(Filename, NULL,
XML_PARSE_NODICT);
        if( reader == NULL )
                return false;

        if (xmlTextReaderPreservePattern(reader, BAD_CAST "", NULL) < 0) {
                xmlFreeTextReader(reader);
                return false;
        }

        int ret = xmlTextReaderRead(reader);

        while (ret == 1) {
                ret = xmlTextReaderRead(reader);
        }
        
        if (ret != 0) {         
                xmlFreeTextReader(reader);
                return false;
        }

        doc = xmlTextReaderCurrentDoc(reader);  

        xmlFreeTextReader(reader);



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