Re: [xml] Memory leak using xmlSchemaParse()



Thanks for your answer!

Actually, I've found the problem and a way of avoiding it. The function was called with : XML_SchemaValidation("http://path/schema.xsd",my_xml_file); and the error in valgrind is due to the connection to http (even if the schema is correctly loaded and the program executes well). So if I copy the schema locally on my computer, there aren't any more memory leaks. So I can use my application without error :-) but apparently, there are memory leaks when loading a file via http. (I used XmlInitParser() once at program startup and called once xmlCleanupParser() at the end and since valgrind didn't point out an error in my program, the error may come from the library)

Anyway, thanks for your help!

Best regards,

Barbara



Andreas Stricker a écrit :
Barbara PHILIPPOT wrote:
    /* Si le XML Schema n'a pas pu être chargé*/
    if (ptr_schema == NULL){
printf("XMLSCHEMA: Could not open XML Schema %s\n", XMLSchemaFile_pathname);
        xmlSchemaCleanupTypes();
        xmlCleanupParser();
        xmlMemoryDump();
        return vl_return;
    }
....
....
xmlSchemaFree(ptr_schema);
....
}

This seems a bit odd. You should initialize the parser for with
LIBXML_TEST_VERSION. Then after all is done call xmlCleanupParser().
Initializing is usually done once at program startup and xmlCleanupParser()
once at program end.

I don't know if the expression (ptr_schema == NULL) evaluates to true and
xmlCleanupParser() is called? But even if so, xmlSchemaFree() should
not be called after xmlCleanupParser().

Cheers, Andy

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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