[ http://issues.apache.org/jira/browse/XERCESC-1455?page=all ]
David Bertoni reassigned XERCESC-1455:
--------------------------------------
Assign To: David Bertoni
> 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]