You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Scott Cantor (Jira)" <xe...@xml.apache.org> on 2019/12/09 17:46:00 UTC
[jira] [Assigned] (XERCESC-2168) Memory leak in ValueVectorOf
[ https://issues.apache.org/jira/browse/XERCESC-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Scott Cantor reassigned XERCESC-2168:
-------------------------------------
Assignee: Scott Cantor
> 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.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-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org