xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Massari <amass...@progress.com>
Subject Re: Memory-Release after using DOMNodeList*?
Date Fri, 05 Mar 2004 11:56:14 GMT
At 09.42 05/03/2004 +0100, Patrick Wicki wrote:
>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!
>
>[...]
>         //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()));

You are pushing a CString into the vector, but you are initializing it 
using the "transcode" method: you need to release that temp buffer.

                 char* 
pStr=XMLString::transcode(sql_statements->item(0)->getTextContent());
                 tag.push_back(pStr);
                 XMLString::release(&pStr);

Alberto

>                 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



---------------------------------------------------------------------
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