Skip to content

Commit

Permalink
Fix issue nasa#169, Remove unnecessary null pointer checks
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Oct 28, 2022
1 parent ac5c332 commit 913262d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/PLASMA/ConstraintEngine/base/DataType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ DataType::~DataType()
{
m_id.remove();

if (m_baseDomain != NULL)
delete m_baseDomain;
delete m_baseDomain;
}

const DataTypeId DataType::getId() const { return m_id; }
Expand Down
6 changes: 2 additions & 4 deletions src/PLASMA/PlanDatabase/base/ObjectType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,7 @@ void* ObjectEvalContext::getElement(const std::string& name) const {

InterpretedObjectFactory::~InterpretedObjectFactory()
{
if (m_superCallExpr != NULL)
delete m_superCallExpr;
delete m_superCallExpr;

for (unsigned int i=0; i < m_constructorBody.size(); i++)
delete m_constructorBody[i];
Expand Down Expand Up @@ -655,8 +654,7 @@ void* ObjectFactoryEvalContext::getElement(const std::string& name) const {
);
ObjectEvalContext evalContext(&factoryEvalContext,instance);

if (m_superCallExpr != NULL)
m_superCallExpr->eval(evalContext);
m_superCallExpr->eval(evalContext);

for (unsigned int i=0; i < m_constructorBody.size(); i++)
m_constructorBody[i]->eval(evalContext);
Expand Down
6 changes: 2 additions & 4 deletions src/PLASMA/Resource/component/FlowProfile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ private:
*/
template<typename FlowGraphType>
void initializeGraphs() {
if(m_lowerLevelGraph != NULL)
delete m_lowerLevelGraph;
delete m_lowerLevelGraph;
m_lowerLevelGraph = new FlowGraphType(m_dummySourceTransaction,
m_dummySinkTransaction, true);

if(m_upperLevelGraph != NULL)
delete m_upperLevelGraph;
delete m_upperLevelGraph;
m_upperLevelGraph = new FlowGraphType(m_dummySourceTransaction,
m_dummySinkTransaction, false);
}
Expand Down
3 changes: 1 addition & 2 deletions src/PLASMA/Solvers/component/OpenConditionDecisionPoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ SupportedOCDecisionPoint::~SupportedOCDecisionPoint()

m_choices.clear();

if (m_heuristic != NULL)
delete m_heuristic;
delete m_heuristic;
}

std::string SupportedOCDecisionPoint::toString() const
Expand Down
2 changes: 1 addition & 1 deletion src/PLASMA/Utils/base/Logger-log4cpp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public:
//TODO - mcr - iterate through and delete loggers
}
delete loggers;
if( instance != NULL ) {delete instance;}
delete instance;
}

void readConfiguration( string configFilename ) {
Expand Down

0 comments on commit 913262d

Please sign in to comment.