Commit 8ddd6a39 authored by Cory Quammen's avatar Cory Quammen Committed by Code Review

Merge topic 'fix_valgrind_error' into master

3a27c8e6 Fixed memory errors in newly added tests
parents e131bb87 3a27c8e6
......@@ -13,6 +13,7 @@
=========================================================================*/
#include <vtkColorTransferFunction.h>
#include <vtkSmartPointer.h>
#include <vtkStdString.h>
#include <vtkStringArray.h>
#include <vtkUnsignedCharArray.h>
......@@ -20,7 +21,7 @@
int TestColorTransferFunctionStringArray(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
{
vtkStringArray* sArray = vtkStringArray::New();
vtkSmartPointer<vtkStringArray> sArray = vtkSmartPointer<vtkStringArray>::New();
const int numStrings = 6;
sArray->SetNumberOfValues(numStrings);
sArray->SetName("TestArray");
......@@ -39,7 +40,7 @@ int TestColorTransferFunctionStringArray(int vtkNotUsed(argc), char* vtkNotUsed(
std::cout << sArray->GetValue(i) << "\n";
}
vtkColorTransferFunction* tfer = vtkColorTransferFunction::New();
vtkSmartPointer<vtkColorTransferFunction> tfer = vtkSmartPointer<vtkColorTransferFunction>::New();
tfer->IndexedLookupOn();
// Need to set some nodes to avoid prematurely returning from
......@@ -54,9 +55,6 @@ int TestColorTransferFunctionStringArray(int vtkNotUsed(argc), char* vtkNotUsed(
vtkUnsignedCharArray* colors = tfer->MapScalars(sArray, VTK_RGBA, -1);
tfer->Delete();
sArray->Delete();
unsigned char expectedColors[numStrings][4] = {
{0, 0, 0, 255},
{255, 0, 0, 255},
......
......@@ -13,6 +13,7 @@
=========================================================================*/
#include <vtkDiscretizableColorTransferFunction.h>
#include <vtkSmartPointer.h>
#include <vtkStdString.h>
#include <vtkStringArray.h>
#include <vtkUnsignedCharArray.h>
......@@ -20,7 +21,7 @@
int TestDiscretizableColorTransferFunctionStringArray(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
{
vtkStringArray* sArray = vtkStringArray::New();
vtkSmartPointer<vtkStringArray> sArray = vtkSmartPointer<vtkStringArray>::New();
const int numStrings = 6;
sArray->SetNumberOfValues(numStrings);
sArray->SetName("TestArray");
......@@ -39,7 +40,8 @@ int TestDiscretizableColorTransferFunctionStringArray(int vtkNotUsed(argc), char
std::cout << sArray->GetValue(i) << "\n";
}
vtkDiscretizableColorTransferFunction* tfer = vtkDiscretizableColorTransferFunction::New();
vtkSmartPointer<vtkDiscretizableColorTransferFunction> tfer =
vtkSmartPointer<vtkDiscretizableColorTransferFunction>::New();
tfer->IndexedLookupOn();
tfer->SetNumberOfIndexedColors(3);
......@@ -52,9 +54,6 @@ int TestDiscretizableColorTransferFunctionStringArray(int vtkNotUsed(argc), char
vtkUnsignedCharArray* colors = tfer->MapScalars(sArray, VTK_RGBA, -1);
tfer->Delete();
sArray->Delete();
unsigned char expectedColors[numStrings][4] = {
{0, 0, 0, 255},
{255, 0, 0, 255},
......
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