[ 
https://issues.apache.org/jira/browse/XERCESC-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Cantor resolved XERCESC-2168.
-----------------------------------
    Resolution: Fixed

Fixed in r1872116

> Memory leak in ValueVectorOf
> ----------------------------
>
>                 Key: XERCESC-2168
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2168
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 3.2.0, 3.2.1, 3.2.2
>            Reporter: Laurent Pelecq
>            Assignee: Scott Cantor
>            Priority: Major
>             Fix For: 3.2.3
>
>         Attachments: memory_leaks_no_realloc.txt, memory_leaks_realloc.txt, 
> xerces_leak.cpp, xerces_operator_leak.patch
>
>
> ValueVectorOf has been changed to call the object destructors for example in 
> ~ValueOfVector:
> {{{color:#205081}template <class TElem> 
> ValueVectorOf<TElem>::~ValueVectorOf(){color}}}
> {{{color:#205081}{{color}}}
> {{    {color:#8eb021}if (fCallDestructor) {{color}}}
> {{{color:#8eb021}        for (XMLSize_t index=fMaxCount; index > 0; 
> index--){color}}}
> {{{color:#8eb021}            fElemList[index-1].~TElem();{color}}}
> {{{color:#8eb021}    }{color}}}
> {{{color:#205081}    fMemoryManager->deallo[link 
> title|http://example.com]cate(fElemList); //delete [] fElemList;{color}}}
> {{{color:#205081}}{color}}}
> But the code is missing in ValueVectorOf<TElem>::operator=.
> A sample code is attached with the corresponding valgrind reports. The sample 
> covers the case where the buffer shrinks (no realloc) or grows (pass realloc 
> as argument to the command).
> The attached patch fixes the leak.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to