xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Akula (JIRA)" <xerces-c-...@xml.apache.org>
Subject [jira] Created: (XERCESC-1455) Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
Date Fri, 08 Jul 2005 13:11:20 GMT
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


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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Mime
View raw message