Don't free an internal object of Xerces-C++ (Bug #2900921)

This commit is contained in:
Zane U. Ji 2012-08-11 13:32:20 +08:00
parent cc30ea4961
commit 8815f65903
1 changed files with 1 additions and 5 deletions

View File

@ -435,7 +435,7 @@ void XmlPromptGenerator::handleSchema (
std::string schemaPath = PathResolver::run ( path, ( d->auxPath.empty() ) ? d->basePath : d->auxPath); std::string schemaPath = PathResolver::run ( path, ( d->auxPath.empty() ) ? d->basePath : d->auxPath);
XercesDOMParser *parser = new XercesDOMParser(); std::auto_ptr<XercesDOMParser> parser ( new XercesDOMParser() );
parser->setDoNamespaces ( true ); parser->setDoNamespaces ( true );
parser->setDoSchema ( true ); parser->setDoSchema ( true );
parser->setValidationSchemaFullChecking ( true ); parser->setValidationSchemaFullChecking ( true );
@ -443,7 +443,6 @@ void XmlPromptGenerator::handleSchema (
Grammar *rootGrammar = parser->loadGrammar ( schemaPath.c_str(), Grammar::SchemaGrammarType ); Grammar *rootGrammar = parser->loadGrammar ( schemaPath.c_str(), Grammar::SchemaGrammarType );
if ( !rootGrammar ) if ( !rootGrammar )
{ {
delete parser;
return; return;
} }
@ -452,8 +451,6 @@ void XmlPromptGenerator::handleSchema (
if ( !elemEnum.hasMoreElements() ) if ( !elemEnum.hasMoreElements() )
{ {
delete grammar;
delete parser;
return; return;
} }
@ -512,7 +509,6 @@ void XmlPromptGenerator::handleSchema (
d->requiredAttributeMap[element].insert ( attribute ); d->requiredAttributeMap[element].insert ( attribute );
} }
} }
delete parser;
} }
void XmlPromptGenerator::getContent ( void XmlPromptGenerator::getContent (