xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Wicki <patrick.wi...@wsl.ch>
Subject Memory-Release after using DOMNodeList*?
Date Fri, 05 Mar 2004 08:42:27 GMT
Hello,
Can anybody tell me, how to release a DOMNodeList*? Or do you happen to see 
what causes a memory leak in the function below!

Best regards
Pat

Following is the function, which seems to cause an error. My App crashes 
after using it about 200 times!

void sdeconn::get_sql_stat_from_xml(std::vector<CString>& tag)
{
	DOMNodeList* sql_statements;
	
	//Get vector-size
	int size=tag.size();

	//Allocate XMLCh for tags
	static XMLCh **pOutputEncoding;
	pOutputEncoding= (XMLCh** ) malloc(size * sizeof(XMLCh*));

	//Translate Tags
	for(int i=0; i<size; i++){
			pOutputEncoding[i] = XMLString::transcode(tag[i]);
	}

	//Clear Vector
	tag.clear();
	
	//Get SQL-Statement and save in vector
	for(i=0; i<size; i++){
		sql_statements = 
get_xml_document()->getElementsByTagName(pOutputEncoding[i]);
		tag.push_back(XMLString::transcode(sql_statements->item(0)->getTextContent()));
		XMLString::release(&pOutputEncoding[i]);
	}

	//Release Memory
	free(pOutputEncoding);
} 


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Mime
View raw message