memory leak and invalid acess in vtkXMLDataElement::RemoveAttribute
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
pointer is overwrited. And, the pointer that should not be erased has been deleted.
--- vtkXMLDataElement.cxx 2008-11-20 17:08:08.000000000 +0900 +++ vtkXMLDataElement.cxx 2009-08-01 00:30:23.181167700 +0900 @@ -91,15 +91,14 @@ { if(!strcmp(this->AttributeNames[i], name)) {
-
delete [] this->AttributeNames[i];
-
delete [] this->AttributeValues[i]; // Shift the other attributes for (j = i; j < this->NumberOfAttributes - 1; ++j) { this->AttributeNames[j] = this->AttributeNames[j + 1]; this->AttributeValues[j] = this->AttributeValues[j + 1]; }
-
// Delete the last one
-
delete [] this->AttributeNames[this->NumberOfAttributes - 1];
-
delete [] this->AttributeValues[this->NumberOfAttributes - 1]; --this->NumberOfAttributes; // this->AttributesSize is unchanged return;