Fix various valgrind errors
This branch fixes the valgrind errors on https://open.cdash.org/viewDynamicAnalysis.php?buildid=3788083, namely vtkInteractionWidgetsCxx-vtkSplineRepresentationTest1, vtkInteractionWidgetsCxx-vtkPolyLineRepresentationTest1, vtkCommonCoreCxx-TestLookupTableThreaded.