Commit 18981309 authored by Berk Geveci's avatar Berk Geveci
Browse files

BUG: Fixed uninitialized memory reads.

Dynamically allocated memory passed to vtk data arrays must be allocated with malloc because vtk arrays release the memory with free.
parent ba827b19
...@@ -1391,7 +1391,7 @@ void vtkExodusMetadata::Finalize() ...@@ -1391,7 +1391,7 @@ void vtkExodusMetadata::Finalize()
} }
vtkCxxRevisionMacro(vtkExodusReader, "1.14"); vtkCxxRevisionMacro(vtkExodusReader, "1.15");
vtkStandardNewMacro(vtkExodusReader); vtkStandardNewMacro(vtkExodusReader);
#ifdef ARRAY_TYPE_NAMES_IN_CXX_FILE #ifdef ARRAY_TYPE_NAMES_IN_CXX_FILE
...@@ -1481,6 +1481,8 @@ vtkExodusReader::vtkExodusReader() ...@@ -1481,6 +1481,8 @@ vtkExodusReader::vtkExodusReader()
this->NumberOfBlocks = 0; this->NumberOfBlocks = 0;
this->NumberOfUsedNodes = 0; this->NumberOfUsedNodes = 0;
this->NumberOfNodesInFile = 0; this->NumberOfNodesInFile = 0;
this->NumberOfNodeSets = 0;
this->NumberOfSideSets = 0;
this->NumberOfTimeSteps = 0; this->NumberOfTimeSteps = 0;
this->ExodusCPUWordSize = 0; this->ExodusCPUWordSize = 0;
this->ExodusIOWordSize = 0; this->ExodusIOWordSize = 0;
...@@ -3689,7 +3691,7 @@ void vtkExodusReader::GenerateExtraArrays(vtkUnstructuredGrid* output) ...@@ -3689,7 +3691,7 @@ void vtkExodusReader::GenerateExtraArrays(vtkUnstructuredGrid* output)
this->GlobalElementIdCache = tmp; this->GlobalElementIdCache = tmp;
} }
int *idList = new int [this->NumberOfUsedElements]; int *idList = (int*)malloc(this->NumberOfUsedElements*sizeof(int));
if (nblocksUsed < nblocks) if (nblocksUsed < nblocks)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment