You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/08/07 06:10:48 UTC

DO NOT REPLY [Bug 22196] New: - Mismatch allocation and deallocation functions

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22196>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22196

Mismatch allocation and deallocation functions

           Summary: Mismatch allocation and deallocation functions
           Product: XalanC
           Version: 1.6
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: XalanC
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: dan@dansmart.com


On line 163 of URISupport.C:
const XalanArrayAutoPtr<XalanDOMChar> theFullPathGuard
(XMLPlatformUtils::getFullPath(c_wstr(urlString)));

However, XMLPlatformUtils::getFullPath no necessarily allocates and returns an 
array of XalanDOMChar, it return memory allocated by the default memory 
manager, which uses "::operator new(size)". This means that the above code 
effectively mixes malloc() with delete[]().
I believe that

XALAN_USING_XERCES(ArrayJanitor);
ArrayJanitor<XalanDOMChar> theFullPathGuard(XMLPlatformUtils::getFullPath
(c_wstr(urlString)),XMLPlatformUtils::fgMemoryManager);

Is better. There may be other occurences of this problem, basically all memory 
allocated and returned by Xerces will have come from the new allocator.

Dan