Commit 3c034c84 authored by Ken Martin's avatar Ken Martin

fix some reported memory leaks

mostly straight gorward memory leaks
parent fa3a8329
......@@ -25,7 +25,10 @@
int TestResampleToImage2D(int argc, char* argv[])
{
vtkNew<vtkXMLUnstructuredGridReader> reader;
reader->SetFileName(vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/delaunay3d.vtu"));
char *fname =
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/delaunay3d.vtu");
reader->SetFileName(fname);
delete [] fname;
vtkNew<vtkResampleToImage> resample;
resample->UseInputBoundsOff();
......
......@@ -30,7 +30,10 @@
int TestScalarsToTexture(int argc, char* argv[])
{
vtkNew<vtkXMLPolyDataReader> reader;
reader->SetFileName(vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/can_slice.vtp"));
char *fname =
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/can_slice.vtp");
reader->SetFileName(fname);
delete [] fname;
vtkNew<vtkColorTransferFunction> stc;
stc->SetVectorModeToMagnitude();
......
......@@ -46,6 +46,8 @@ vtkOBJExporter::vtkOBJExporter()
vtkOBJExporter::~vtkOBJExporter()
{
delete [] this->OBJFileComment;
delete [] this->MTLFileComment;
delete [] this->FilePrefix;
}
......
......@@ -40,11 +40,15 @@ int TestOBJPolyDataWriter(int argc, char* argv[])
sphereSource->SetPhiResolution(16);
vtkNew<vtkJPEGReader> textReader;
textReader->SetFileName(
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/NE2_ps_bath_small.jpg"));
std::string tmpDir(
vtkTestUtilities::GetArgOrEnvOrDefault("-T", argc, argv, "VTK_TEMP_DIR", "Testing/Temporary"));
char *fname =
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/NE2_ps_bath_small.jpg");
textReader->SetFileName(fname);
delete [] fname;
char *tname =
vtkTestUtilities::GetArgOrEnvOrDefault("-T", argc, argv, "VTK_TEMP_DIR", "Testing/Temporary");
std::string tmpDir(tname);
delete [] tname;
std::string filename = tmpDir + "/TestOBJPolyDataWriter_write.obj";
vtkNew<vtkOBJWriter> writer;
......
......@@ -41,6 +41,7 @@ int TestPDALReader_@VTK_PDAL_READER_POSTFIX@(int argc, char **argv)
vtkNew<vtkPDALReader> reader;
//Select source file
reader->SetFileName(path);
delete [] path;
//Read the output
reader->Update();
......
......@@ -67,8 +67,10 @@ vtkPDALReader::vtkPDALReader()
//----------------------------------------------------------------------------
vtkPDALReader::~vtkPDALReader()
{
if ( ! this->FileName )
delete[] this->FileName;
if ( this->FileName )
{
delete [] this->FileName;
}
}
//----------------------------------------------------------------------------
......
......@@ -32,6 +32,7 @@ int TestXMLWriteRead(int argc, char* argv[])
char* tempDir =
vtkTestUtilities::GetArgOrEnvOrDefault("-T", argc, argv, "VTK_TEMP_DIR", "Testing/Temporary");
std::string fileName(tempDir);
delete [] tempDir;
int statusFloat, statusDouble;
......
......@@ -1186,6 +1186,10 @@ void vtkXMLDataParser::FreeAsciiBuffer()
vtkTemplateMacro(
vtkXMLDataParserFreeAsciiBuffer(static_cast<VTK_TT*>(buffer))
);
case VTK_BIT:
vtkXMLDataParserFreeAsciiBuffer(static_cast<unsigned char *>(buffer));
break;
}
this->AsciiDataBuffer = nullptr;
}
......
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