Commit 2a7b9222 authored by camp's avatar camp

Fixed a memory lead with GetAllLeaves function.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@13446 18c085ea-50e0-402c-830e-de6fd14e8384
parent 59838f28
......@@ -378,6 +378,10 @@ avtDataBinningConstructor::ConstructDataBinning(
int val = UnifyMaximumValue((hasError ? 1 : 0));
if (val > 0)
{
// Free the memory from the GetAllLeaves function call.
delete [] leaves;
delete [] isNodal;
debug1 << "Could not create data binning because either a "
"variable could not be located, or because"
" the centering of the variables do not "
......
......@@ -455,8 +455,11 @@ avtPythonExpression::Execute()
PyObject *py_domids = PyTuple_New(nsets);
if(py_dsets == NULL || py_domids == NULL)
{
delete [] data_sets;
PYEXPR_ERROR("avtPythonExpression::Execute Error - "
"Unable to create execution input lists");
}
// array to hold output leaves
avtDataTree_p *leaves = new avtDataTree_p[nsets];
......@@ -465,13 +468,20 @@ avtPythonExpression::Execute()
for(int i = 0; i < nsets ; i++)
{
if(PyTuple_SetItem(py_dsets,i,pyEnv->WrapVTKObject(data_sets[i],"vtkDataSet")) != 0)
{
delete [] data_sets;
PYEXPR_ERROR("avtPythonExpression::Execute Error - "
"Unable to add data set to execution input list");
}
if(PyTuple_SetItem(py_domids,i,PyInt_FromLong(domain_ids[i])) != 0)
{
delete [] data_sets;
PYEXPR_ERROR("avtPythonExpression::Execute Error - "
"Unable to add domain id to execution input list");
}
}
delete [] data_sets;
// call execute on Filter
PyObject *py_filter = pyEnv->Filter()->PythonObject();
......
......@@ -226,7 +226,15 @@ avtResampleFilter::InputNeedsNoResampling(void)
int n = 0;
vtkDataSet **in_dss = inDT->GetAllLeaves(n);
if (n && in_dss && in_dss[0] && in_dss[0]->GetDataObjectType() == VTK_POLY_DATA)
{
// Free the memory from the GetAllLeaves function call.
delete [] in_dss;
return true;
}
// Free the memory from the GetAllLeaves function call.
delete [] in_dss;
#endif
return false;
......
......@@ -625,6 +625,9 @@ avtXRayFilter::Execute(void)
delete [] imageFragments[i];
delete [] imageFragmentSizes;
delete [] imageFragments;
// Free the memory from the GetAllLeaves function call.
delete [] dataSets;
}
......
......@@ -809,6 +809,8 @@ avtDataTree::GetSingleLeaf(void)
vtkDataSet **ds = GetAllLeaves(nLeaves);
if (nLeaves != 1)
{
delete [] ds;
// Hmmm... we were earlier quoted one leaf, but now we got more than
// one.
debug1 << "avtDataTree::GetSingleLeaf ... unexpected case."
......
......@@ -693,7 +693,11 @@ avtDataset::RenumberDomainIDs(bool acrossAllProcs)
}
if (numLeaves == 0) // had to wait this long to do parallel communication.
{
// Free the memory from the GetAllLeaves function call.
delete [] leaves;
return;
}
avtDataTree_p *newTrees = new avtDataTree_p[numLeaves];
for (i = 0 ; i < numLeaves ; i++)
......@@ -702,6 +706,9 @@ avtDataset::RenumberDomainIDs(bool acrossAllProcs)
dataTree = new avtDataTree(numLeaves, newTrees);
delete [] newTrees; // new array allocated by avtDataTree constructor
// Free the memory from the GetAllLeaves function call.
delete [] leaves;
}
......@@ -201,11 +201,13 @@ avtNamedSelectionManager::CreateNamedSelection(avtDataObject_p dob,
GetArray("avtOriginalCellNumbers");
if (ocn == NULL)
{
delete [] leaves;
EXCEPTION0(ImproperUseException);
}
unsigned int *ptr = (unsigned int *) ocn->GetVoidPointer(0);
if (ptr == NULL)
{
delete [] leaves;
EXCEPTION0(ImproperUseException);
}
......@@ -219,6 +221,7 @@ avtNamedSelectionManager::CreateNamedSelection(avtDataObject_p dob,
zones[curSize+j] = ptr[2*j+1];
}
}
delete [] leaves;
// Note the poor use of MPI below, coded for expediency, as I believe all
// of the named selections will be small.
......
......@@ -548,6 +548,9 @@ avtPythonQuery::Execute()
"Unable to add domain id to execution input list");
}
// Free the memory from the GetAllLeaves function call.
delete [] data_sets;
// call execute on Filter
PyObject *py_filter = pyEnv->Filter()->PythonObject();
if(py_filter == NULL)
......@@ -555,7 +558,7 @@ avtPythonQuery::Execute()
"Python filter not initialized.");
// get the execute method
PyObject *py_exe= PyString_FromString("execute");
PyObject *py_exe = PyString_FromString("execute");
if(py_exe == NULL)
PYQUERY_ERROR("avtPythonQuery::Execute Error - "
"Error preparing for call of 'execute' method.");
......@@ -571,7 +574,6 @@ avtPythonQuery::Execute()
Py_DECREF(py_dsets);
Py_DECREF(py_domids);
Py_DECREF(py_exe);
}
// ****************************************************************************
......
......@@ -405,6 +405,10 @@ avtXRayImageQuery::Execute(avtDataTree_p tree)
if (nLeaves <= 0)
{
// Free the memory from the GetAllLeaves function call.
delete [] leaves;
delete filt;
EXCEPTION1(VisItException, "There must be at least one bin.");
}
......@@ -434,7 +438,7 @@ avtXRayImageQuery::Execute(avtDataTree_p tree)
if (outputType >=0 && outputType <= 4)
{
string msg = "";
char *exts[5] = {"bmp", "jpeg", "png", "tif", "bof"};
const char *exts[5] = {"bmp", "jpeg", "png", "tif", "bof"};
char buf[512];
if (nLeaves == 1)
......@@ -454,6 +458,9 @@ avtXRayImageQuery::Execute(avtDataTree_p tree)
SetResultMessage("No x ray image query results were written "
"because the output type was invalid\n");
}
// Free the memory from the GetAllLeaves function call.
delete [] leaves;
}
visitTimer->StopTimer(t2, "avtXRayImageQuery::WriteImage");
......
......@@ -399,17 +399,26 @@ avtPersistentParticlesFilter::IterateMergeData(int ts, avtDataTree_p tree)
SumIntAcrossAllProcessors(nds2);
if (nds2 < 1 || nds > 1)
{
// Free the memory from the GetAllLeaves function call.
delete [] dsets;
EXCEPTION1(ImproperUseException, "Filter expected only one vtkDataSet"
" in avtDataTree");
}
if (nds == 0)
{
// Free the memory from the GetAllLeaves function call.
delete [] dsets;
haveData = false;
return;
}
vtkDataSet *currDs = dsets[0];
// Free the memory from the GetAllLeaves function call.
delete [] dsets;
uGrid = vtkPointSet::SafeDownCast(currDs);
if (uGrid == 0)
{
......@@ -507,17 +516,26 @@ avtPersistentParticlesFilter::IterateTraceData(int ts, avtDataTree_p tree)
SumIntAcrossAllProcessors(nds2);
if (nds2 < 1 || nds > 1)
{
// Free the memory from the GetAllLeaves function call.
delete [] dsets;
EXCEPTION1(ImproperUseException, "Filter expected only one vtkDataSet"
" in avtDataTree");
}
if (nds == 0)
{
// Free the memory from the GetAllLeaves function call.
delete [] dsets;
haveData = false;
return;
}
vtkDataSet *currDs = dsets[0];
// Free the memory from the GetAllLeaves function call.
delete [] dsets;
uGrid = vtkPointSet::SafeDownCast(currDs);
if (uGrid == 0)
{
......
......@@ -271,6 +271,9 @@ avtTraceHistoryFilter::InitializeDataset(void)
nVars = atts.GetNumberOfVariables();
}
// Free the memory from the GetAllLeaves function call.
delete [] ds;
return rv;
}
......
......@@ -271,19 +271,34 @@ avtMultiCurveFilter::Execute(void)
//
if (nSets < 1)
{
// Free the memory from the GetAllLeaves function call.
delete [] dataSets;
EXCEPTION1(ImproperUseException, "Expecting at least one dataset");
}
else if (nSets > 1)
{
for (int i = 0; i < nSets; i++)
{
if (dataSets[i]->GetDataObjectType() != VTK_POLY_DATA)
{
// Free the memory from the GetAllLeaves function call.
delete [] dataSets;
EXCEPTION1(ImproperUseException, "Expecting poly data");
}
}
SetOutputDataTree(tree);
setYAxisTickSpacing = false;
// Free the memory from the GetAllLeaves function call.
delete [] dataSets;
return;
}
vtkDataSet *inDS = dataSets[0];
// Free the memory from the GetAllLeaves function call.
delete [] dataSets;
int domain = domains[0];
if (inDS->GetDataObjectType() != VTK_RECTILINEAR_GRID)
......
......@@ -2377,6 +2377,9 @@ avtParallelCoordinatesFilter::CreateNamedSelectionThroughTraversal(
pointIdList->Delete();
}
// Free the memory from the GetAllLeaves function call.
delete [] leaves;
// Note the poor use of MPI below, coded for expediency, as I believe all
// of the named selections will be small.
int *numPerProcIn = new int[PAR_Size()];
......
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