xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rinil Baxi (JIRA)" <xerces-c-...@xml.apache.org>
Subject [jira] Commented: (XERCESC-1624) Memory leak on Tandem platform
Date Thu, 10 Aug 2006 07:33:16 GMT
    [ http://issues.apache.org/jira/browse/XERCESC-1624?page=comments#action_12427128 ] 
Rinil Baxi commented on XERCESC-1624:

DOM parser API DOMBuilderImpl::parseURI is invoked with the name of 
the XML file to be parsed as the argument. This API invokes the 
method  XMLPlatformUtils::getFullPath. getFullPath method returns the
the fully qualified path of the file. This methods declares a local
char pointer to hold the current directory name. This char pointer 
is not released before returning from the method. This leads to a
memory leak.

Relevant part of Code:

    char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);

    // Use a local buffer that is big enough for the largest legal path
     char* tmpPath = dirname((char*)newSrc);  < ---- char pointer 
                                              declared not deleted
    if (!tmpPath)


Recommended Fix

    char* newXMLString = (char*) fgMemoryManager->allocate
        (strlen(tmpPath) +1) * sizeof(char)
    );//new char [strlen(tmpPath) +1];
    ArrayJanitor<char> newJanitor(newXMLString, fgMemoryManager);
    strcpy(newXMLString, tmpPath);
        strcat(newXMLString , "/");
    fgMemoryManager->deallocate(newSrc);   ---------> This will deallocate the char
pointer declared

> Memory leak on Tandem platform
> ------------------------------
>                 Key: XERCESC-1624
>                 URL: http://issues.apache.org/jira/browse/XERCESC-1624
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: DOM
>    Affects Versions: 2.4.0
>         Environment: HP Tandem NonStop Kernel
>            Reporter: Rinil Baxi
> Xercers DOM API parser->resetDocumentPool() does not release all 
> the allocated memory by the DOM parser API parser->parseURI(xmlFile).

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


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

View raw message