Re: [xml] Memory leak using xmlSchemaParse()



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




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