Commit 284bfa4a authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri

Fixed some memory leaks as detected by the leaks sanitizer

parent c783fc3b
......@@ -53,6 +53,8 @@ vtkSmartPointer<vtkXMLPolyDataReader> ReadUVCDATPolyData(int argc, char* argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
return reader;
}
......
......@@ -53,6 +53,8 @@ vtkSmartPointer<vtkXMLPolyDataReader> ReadUVCDATPolyData(int argc, char* argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
return reader;
}
......
......@@ -49,6 +49,8 @@ int TestLASReader_@VTK_LAS_READER_POSTFIX@(int argc, char **argv)
//Read the output
reader->Update();
delete [] path;
vtkSmartPointer<vtkPolyData> outputData = reader->GetOutput();
bool useClassification = false;
......
......@@ -50,6 +50,8 @@ vtkSmartPointer<vtkXMLPolyDataReader> ReadUVCDATPolyData(int argc, char* argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
return reader;
}
......
......@@ -47,6 +47,8 @@ int TestCoincident(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
// render points then lines then surface
......
......@@ -50,6 +50,8 @@ int TestCubeMap(int argc, char *argv[])
vtkNew<vtkPLYReader> reader;
reader->SetFileName(fileName);
delete [] fileName;
vtkNew<vtkPolyDataNormals> norms;
norms->SetInputConnection(reader->GetOutputPort());
......@@ -66,8 +68,10 @@ int TestCubeMap(int argc, char *argv[])
for (int i = 0; i < 6; i++)
{
vtkNew<vtkJPEGReader> imgReader;
imgReader->SetFileName(
vtkTestUtilities::ExpandDataFileName(argc, argv, fpath[i]));
const char * fName =
vtkTestUtilities::ExpandDataFileName(argc, argv, fpath[i]);
imgReader->SetFileName( fName );
delete [] fName;
vtkNew<vtkImageFlip> flip;
flip->SetInputConnection(imgReader->GetOutputPort());
flip->SetFilteredAxis(1); // flip y axis
......
......@@ -56,6 +56,8 @@ int TestCubeMap2(int argc, char *argv[])
vtkNew<vtkPLYReader> reader;
reader->SetFileName(fileName);
delete [] fileName;
vtkNew<vtkPolyDataNormals> norms;
norms->SetInputConnection(reader->GetOutputPort());
......@@ -83,13 +85,15 @@ int TestCubeMap2(int argc, char *argv[])
for (int i = 0; i < 6; i++)
{
const char * fName =
vtkTestUtilities::ExpandDataFileName(argc, argv, fpath[i]);
vtkNew<vtkJPEGReader> imgReader;
imgReader->SetFileName(
vtkTestUtilities::ExpandDataFileName(argc, argv, fpath[i]));
imgReader->SetFileName(fName);
vtkNew<vtkImageFlip> flip;
flip->SetInputConnection(imgReader->GetOutputPort());
flip->SetFilteredAxis(1); // flip y axis
texture->SetInputConnection(i, flip->GetOutputPort(0));
delete [] fName;
}
vtkNew<vtkOpenGLPolyDataMapper> mapper;
......
......@@ -53,6 +53,8 @@ int TestDepthOfFieldPass(int argc, char* argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
mapper->SetInputConnection(reader->GetOutputPort());
// create three dragons
......
......@@ -50,6 +50,8 @@ int TestFramebufferHDR(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(reader->GetOutputPort());
......
......@@ -51,6 +51,8 @@ int TestFramebufferPass(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(reader->GetOutputPort());
......
......@@ -60,6 +60,8 @@ int TestLightingMapLuminancePass(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(reader->GetOutputPort());
......
......@@ -60,6 +60,8 @@ int TestLightingMapNormalsPass(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(reader->GetOutputPort());
......
......@@ -54,6 +54,8 @@ int TestPointFillPass(int argc, char* argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
mapper->SetInputConnection(reader->GetOutputPort());
// create three dragons
......
......@@ -37,9 +37,12 @@ int TestSRGB(int argc, char *argv[])
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renderWindow.Get());
const char * fileName =
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/skybox/posz.jpg");
vtkNew<vtkJPEGReader> imgReader;
imgReader->SetFileName(
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/skybox/posz.jpg"));
imgReader->SetFileName(fileName);
delete [] fileName;
vtkNew<vtkPlaneSource> plane;
......
......@@ -79,6 +79,8 @@ int TestSSAAPass(int argc, char* argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
mapper->SetInputConnection(reader->GetOutputPort());
actor->GetProperty()->SetAmbientColor(0.2, 0.2, 1.0);
actor->GetProperty()->SetDiffuseColor(1.0, 0.65, 0.7);
......
......@@ -48,6 +48,8 @@ int TestSetZBuffer(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
mapper->SetInputConnection(reader->GetOutputPort());
actor->SetMapper(mapper);
actor->GetProperty()->SetAmbientColor(0.2, 0.2, 1.0);
......
......@@ -61,6 +61,8 @@ int TestShadowMapBakerPass(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
mapper->SetInputConnection(reader->GetOutputPort());
//mapper->SetInputConnection(norms->GetOutputPort());
actor->SetMapper(mapper);
......
......@@ -72,6 +72,8 @@ int TestShadowMapPass(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(reader->GetOutputPort());
......
......@@ -49,6 +49,8 @@ int TestSimpleMotionBlur(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(reader->GetOutputPort());
......
......@@ -48,6 +48,8 @@ int TestUserShader(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkNew<vtkTriangleMeshPointNormals> norms;
norms->SetInputConnection(reader->GetOutputPort());
norms->Update();
......
......@@ -105,6 +105,8 @@ int TestUserShader2(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkNew<vtkTriangleMeshPointNormals> norms;
norms->SetInputConnection(reader->GetOutputPort());
norms->Update();
......
......@@ -70,6 +70,8 @@ int TestVBOPLYMapper(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
// vtkNew<vtkPolyDataNormals> norms;
// norms->SetInputConnection(reader->GetOutputPort());
// norms->Update();
......
......@@ -60,6 +60,8 @@ int TestValuePass(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
cerr << reader->GetOutput()->GetBounds()[0] << ", "
<< reader->GetOutput()->GetBounds()[1] << endl;
......
......@@ -46,6 +46,8 @@ int TestGPURayCastClipping(int argc, char *argv[])
reader->Update();
volumeMapper->SetInputConnection(reader->GetOutputPort());
delete [] volumeFile;
volumeMapper->GetInput()->GetScalarRange(scalarRange);
volumeMapper->SetBlendModeToComposite();
......
......@@ -58,6 +58,8 @@ int TestGPURayCastClippingPolyData(int argc, char *argv[])
reader->SetFileName(volumeFile);
volumeMapper->SetInputConnection(reader->GetOutputPort());
delete [] volumeFile;
/// Outline filter
vtkNew<vtkOutlineFilter> outlineFilter;
outlineFilter->SetInputConnection(reader->GetOutputPort());
......
......@@ -102,6 +102,9 @@ static void UpdateFrontClippingPlane(vtkPlane* frontClippingPlane,
// Set the normal and origin of the front clipping plane
frontClippingPlane->SetNormal(frontNormal);
frontClippingPlane->SetOrigin(frontOrigin);
delete [] frontNormal;
delete [] frontOrigin;
}
......@@ -121,6 +124,9 @@ static void UpdateRearClippingPlane(vtkPlane* rearClippingPlane, double* normal,
// Set the normal and origin of the rear clipping plane
rearClippingPlane->SetNormal(rearNormal);
rearClippingPlane->SetOrigin(rearOrigin);
delete [] rearNormal;
delete [] rearOrigin;
}
......
......@@ -47,6 +47,8 @@ int TestGPURayCastPositionalLights(int argc, char *argv[])
reader->SetFileName(volumeFile);
volumeMapper->SetInputConnection(reader->GetOutputPort());
delete [] volumeFile;
volumeMapper->GetInput()->GetScalarRange(scalarRange);
volumeMapper->SetBlendModeToComposite();
volumeMapper->SetAutoAdjustSampleDistances(0);
......
......@@ -51,6 +51,8 @@ int TestGPURayCastReleaseResources(int argc, char *argv[])
reader->Update();
volumeMapper->SetInputConnection(reader->GetOutputPort());
delete [] volumeFile;
volumeMapper->GetInput()->GetScalarRange(scalarRange);
volumeMapper->SetBlendModeToComposite();
......
......@@ -51,6 +51,8 @@ int TestGPURayCastVolumeLightKit(int argc, char *argv[])
reader->SetFileName(volumeFile);
volumeMapper->SetInputConnection(reader->GetOutputPort());
delete [] volumeFile;
volumeMapper->GetInput()->GetScalarRange(scalarRange);
volumeMapper->SetBlendModeToComposite();
volumeMapper->SetAutoAdjustSampleDistances(0);
......
......@@ -140,6 +140,8 @@ int TestGPURayCastVolumePicking(int argc, char *argv[])
const char* volumeFile = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/vase_1comp.vti");
reader->SetFileName(volumeFile);
delete [] volumeFile;
vtkNew<vtkImageChangeInformation> changeInformation;
changeInformation->SetInputConnection(reader->GetOutputPort());
changeInformation->SetOutputSpacing(1, 2, 3);
......
......@@ -53,6 +53,8 @@ int TestGPURayCastVolumePolyData(int argc, char *argv[])
reader->SetFileName(volumeFile);
volumeMapper->SetInputConnection(reader->GetOutputPort());
delete [] volumeFile;
// Add outline filter
vtkNew<vtkOutlineFilter> outlineFilter;
outlineFilter->SetInputConnection(reader->GetOutputPort());
......
......@@ -52,6 +52,8 @@ int TestGPURayCastVolumeScale(int argc, char *argv[])
argc, argv, "Data/vase_1comp.vti");
reader->SetFileName(volumeFile);
delete [] volumeFile;
vtkSmartPointer<vtkImageChangeInformation> changeInformation =
vtkSmartPointer<vtkImageChangeInformation>::New();
changeInformation->SetInputConnection(reader->GetOutputPort());
......
......@@ -50,6 +50,8 @@ int TestMultiBlockMapper(int argc, char *argv[])
reader->SetFileName(fileName);
reader->Update();
delete [] fileName;
vtkNew<vtkMultiBlockVolumeMapper> mapper;
mapper->SetInputConnection(reader->GetOutputPort());
mapper->SelectScalarArray("MetaImage");
......
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