Commit 95574593 authored by Sean McBride's avatar Sean McBride

Fixed memory leaks found by cppcheck

Change-Id: Ieadbc4b11706f022d113cf975ef7db6ea5bb0f55
parent bf7dbc51
......@@ -2108,6 +2108,12 @@ int InvertMatrix()
}
if (vtkMath::InvertMatrix(mat, matI, NDimension, tmp1, tmp2) == 0)
{
delete [] mat;
delete [] orig;
delete [] matI;
delete [] ident;
delete [] tmp1;
delete [] tmp2;
return status;
}
vtkMath::MultiplyMatrix(orig,
......
......@@ -318,6 +318,8 @@ int vtkWeightedTransformFilter::RequestData(
{
vtkErrorMacro(<<"WeightArray " << this->WeightArray <<
" " << "doesn't exist");
delete [] linearNormMtx;
delete [] linearPtMtx;
return 1;
}
......@@ -348,6 +350,8 @@ int vtkWeightedTransformFilter::RequestData(
{
vtkErrorMacro(<<"TransformIndexArray " << this->TransformIndexArray <<
" " << "doesn't exist");
delete [] linearNormMtx;
delete [] linearPtMtx;
return 1;
}
......@@ -387,6 +391,8 @@ int vtkWeightedTransformFilter::RequestData(
{
vtkErrorMacro(<<"CellDataWeightArray " << this->CellDataWeightArray <<
" " << "doesn't exist");
delete [] linearNormMtx;
delete [] linearPtMtx;
return 1;
}
cdComponents = cdArray->GetNumberOfComponents();
......@@ -420,6 +426,8 @@ int vtkWeightedTransformFilter::RequestData(
vtkErrorMacro(<<"CellDataTransformIndexArray " <<
this->CellDataTransformIndexArray <<
" " << "doesn't exist");
delete [] linearNormMtx;
delete [] linearPtMtx;
return 1;
}
......@@ -450,6 +458,8 @@ int vtkWeightedTransformFilter::RequestData(
if ( !inPts )
{
vtkErrorMacro(<<"No input data");
delete [] linearNormMtx;
delete [] linearPtMtx;
return 1;
}
......
......@@ -1710,6 +1710,7 @@ vtkIdTypeArray **
"vtkDistributedDataFilter::ExchangeIdArrays memory allocation");
delete [] sendSize;
delete [] recvSize;
delete [] recvArrays;
return NULL;
}
mpiContr->NoBlockReceive(recvArrays[source], recvSize[source], source, tag, req);
......@@ -1859,6 +1860,7 @@ vtkUnstructuredGrid *
{
vtkErrorMacro(<<
"vtkDistributedDataFilter::ExchangeMergeSubGrids memory allocation");
delete [] grids;
return NULL;
}
recvBufSize = packedGridRecvSize;
......
......@@ -415,6 +415,7 @@ int TestIncrementalOctreePointLocator( int argc, char * argv[] )
{
cerr << "IO error " << __FILE__ << ":" << __LINE__ << "\n";
fclose(pntsFile);
free(pDataPts);
return 1;
}
#ifdef VTK_WORDS_BIGENDIAN
......@@ -429,6 +430,10 @@ int TestIncrementalOctreePointLocator( int argc, char * argv[] )
{
cerr << "IO error " << __FILE__ << ":" << __LINE__ << "\n";
fclose(pntsFile);
free(pLocPnts);
free(minDist2);
free(maxDist2);
free(pDataPts);
return 1;
}
//fread( minDist2, sizeof( double ), nLocPnts, pntsFile );
......
......@@ -718,6 +718,7 @@ static int vtkWrapHierarchy_CompareHierarchyFile(FILE *fp, char *lines[])
if (!line)
{
free(oldline);
free(matched);
return 0;
}
if (!fgets(&line[n], (int)(maxlen-n), fp)) { break; }
......
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