[ http://issues.apache.org/jira/browse/XERCESC-1455?page=comments#action_12316051 ]
David Bertoni commented on XERCESC-1455: ---------------------------------------- It's actually worse than this. This class is completely broken with respect to holding object instances by value. I'm going to work on a patch that limits the use of this class to PODs. > Template ValueVectorOf does not call destructors for removing objects. A > memory leak could result from this. > ------------------------------------------------------------------------------------------------------------ > > Key: XERCESC-1455 > URL: http://issues.apache.org/jira/browse/XERCESC-1455 > Project: Xerces-C++ > Type: Bug > Components: Utilities > Versions: 2.3.0 > Environment: Solaris > Reporter: Alex Akula > Assignee: David Bertoni > > When objects get removed from ValueVectorOf < object type> container no > destructors are called for the objects. Amemory leak could result from this. > This could be fixed by changing the code: > template <class TElem> void ValueVectorOf<TElem>:: > removeElementAt(const unsigned int removeAt) > { > if (removeAt >= fCurCount) > ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex); > fElemList[removeAt] = 0; // akula -- this is the fix for classes in > which assign operator is overloaded appropriate way. > if (removeAt == fCurCount-1) > { > fCurCount--; > return; > } > // Copy down every element above remove point > for (unsigned int index = removeAt; index < fCurCount-1; index++) > fElemList[index] = fElemList[index+1]; > // And bump down count > fCurCount--; > } -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
