Commit 4d0b8189 authored by David E DeMarle's avatar David E DeMarle
Browse files

Merge branch 'fix_valgrind_issues_with_cam_reader' into 'master'

Fix uninitialized memory reported by valgrind.

23dff2bd introduced a bug where it didn't copy the point data correctly
for all the layers. Fixed that.

See merge request !438
parents 71ab7e7b 1c787973
...@@ -668,13 +668,15 @@ int vtkNetCDFCAMReader::RequestData( ...@@ -668,13 +668,15 @@ int vtkNetCDFCAMReader::RequestData(
pointData->CopyAllocate(output->GetPointData(), pointData->CopyAllocate(output->GetPointData(),
output->GetNumberOfPoints()); output->GetNumberOfPoints());
vtkIdType newPtId = numFilePoints; vtkIdType newPtId=0;
for (std::vector<vtkIdType>::const_iterator it= for (std::vector<vtkIdType>::const_iterator it=
boundaryPoints.begin(); it!=boundaryPoints.end(); ++it, ++newPtId) boundaryPoints.begin(); it!=boundaryPoints.end(); ++it, ++newPtId)
{ {
for(long lev=0;lev<numLocalCellLevels+1-this->SingleLevel;lev++) for(long lev=0;lev<numLocalCellLevels+1-this->SingleLevel;lev++)
{ {
pointData->CopyData(pointData, (*it), newPtId); vtkIdType srcId = (*it) + lev * numPointsPerLevel;
vtkIdType destId = (newPtId + numFilePoints) + lev * numPointsPerLevel;
pointData->CopyData(pointData, srcId, destId);
} }
} }
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