Skip to content

Commit

Permalink
HPCC-32040 Fix various IPT leaks
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Jun 11, 2024
1 parent 444974f commit 4296177
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 35 deletions.
3 changes: 1 addition & 2 deletions dali/base/dacsds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,13 +1108,12 @@ void CClientRemoteTree::resetState(unsigned _state, bool sub)
serverId = 0;
if (sub)
{
IPropertyTreeIterator *iter = getElements("*");
Owned<IPropertyTreeIterator> iter = getElements("*");
ForEach(*iter)
{
CClientRemoteTree &child = (CClientRemoteTree &)iter->query();
child.resetState(state, sub);
}
iter->Release();
}
}

Expand Down
2 changes: 1 addition & 1 deletion dali/base/dafdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3845,7 +3845,7 @@ class CStorageApiInfo : public CInterfaceOf<IStorageApiInfo>
throw makeStringExceptionV(-1, "No container provided: path %s", path.str());
return container;
}
Linked<IPropertyTree> xml;
Owned<IPropertyTree> xml;
};

class CStoragePlaneInfo : public CInterfaceOf<IStoragePlane>
Expand Down
4 changes: 1 addition & 3 deletions dali/base/dasds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2699,7 +2699,7 @@ class CServerRemoteTree : public CRemoteTreeBase

if (cutoff < 0 || depth<cutoff)
{
IPropertyTreeIterator *iter = getElements("*");
Owned<IPropertyTreeIterator> iter = getElements("*");
iter->first();
while (iter->isValid())
{
Expand All @@ -2708,8 +2708,6 @@ class CServerRemoteTree : public CRemoteTreeBase
child->serializeCutOffRT(tgt, cutoff, depth+1, extValues);
iter->next();
}
iter->Release();

}
tgt.append(""); // element terminator. i.e. blank child name.
}
Expand Down
3 changes: 1 addition & 2 deletions dali/base/dasds.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public:
bool res = true;
if (op.applyTop(node))
{
IPropertyTreeIterator *iter = node.getElements("*");
Owned<IPropertyTreeIterator> iter = node.getElements("*");
if (iter->first())
{
bool levelBreak = false;
Expand All @@ -180,7 +180,6 @@ public:
iter->next();
}
}
iter->Release();
}
return res;
}
Expand Down
3 changes: 1 addition & 2 deletions dali/ft/filecopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2790,14 +2790,13 @@ bool FileSprayer::restorePartition()
{
if (allowRecovery && progressTree->getPropBool(ANhasPartition))
{
IPropertyTreeIterator * iter = progressTree->getElements(PNpartition);
Owned<IPropertyTreeIterator> iter = progressTree->getElements(PNpartition);
ForEach(*iter)
{
PartitionPoint & next = * new PartitionPoint;
next.restore(&iter->query());
partition.append(next);
}
iter->Release();
return (partition.ordinality() != 0);
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion ecl/eclcc/eclcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3286,7 +3286,7 @@ int EclCC::parseCommandLineOptions(int argc, const char* argv[])

void EclCC::setSecurityOptions()
{
IPropertyTree *eclSecurity = configuration->getPropTree("eclSecurity");
Owned<IPropertyTree> eclSecurity = configuration->getPropTree("eclSecurity");
if (eclSecurity)
{
// Name of security option in configuration yaml
Expand Down
11 changes: 4 additions & 7 deletions esp/bindings/http/platform/msgbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void CSoapMsgBuilder::setPropertyValueBool(const char * key, bool val)

StringBuffer & CSoapMsgBuilder::getSoapResponse(StringBuffer & soapResponse)
{
IPropertyTreeIterator * itr = m_properties->getElements("*");
Owned<IPropertyTreeIterator> itr = m_properties->getElements("*");
itr->first();
while(itr->isValid())
{
Expand All @@ -77,7 +77,6 @@ StringBuffer & CSoapMsgBuilder::getSoapResponse(StringBuffer & soapResponse)
soapResponse.appendf("<%s>%s</%s>", key.str(), val.str(), key.str());
itr->next();
}
itr->Release();
return soapResponse;
}

Expand Down Expand Up @@ -140,7 +139,7 @@ StringBuffer & CSoapMsgXsdBuilder::getXsd(StringBuffer & wsdlSchema)
wsdlSchema.appendf("<%s:complexType name=\"%s\" >", m_var.str(), m_structLabel.str());
wsdlSchema.appendf("<%s:sequence>", m_var.str());

IPropertyTreeIterator * itr = m_properties->getElements("*");
Owned<IPropertyTreeIterator> itr = m_properties->getElements("*");
itr->first();
while(itr->isValid())
{
Expand All @@ -150,7 +149,6 @@ StringBuffer & CSoapMsgXsdBuilder::getXsd(StringBuffer & wsdlSchema)
wsdlSchema.appendf("<%s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"%s\" type=\"xsd:%s\"/>", m_var.str(), name.str(), getXsdTypeLabel(static_cast<XSD_TYPES>(m_properties->getPropInt(name.str()))));
itr->next();
}
itr->Release();
wsdlSchema.appendf("</%s:sequence>", m_var.str());
wsdlSchema.appendf("</%s:complexType>", m_var.str());

Expand All @@ -162,7 +160,7 @@ StringBuffer & CSoapMsgXsdBuilder::getXsd(StringBuffer & wsdlSchema)

wsdlSchema.appendf("<%s:element name=\"%s\" nillable=\"true\" type=\"tns:%s\" />", m_var.str(), m_structLabel.str(), m_structLabel.str());
wsdlSchema.appendf("<%s:element name=\"ArrayOf%s\" nillable=\"true\" type=\"tns:ArrayOf%s\" />", m_var.str(), m_structLabel.str(), m_structLabel.str());
return wsdlSchema;
return wsdlSchema;
}

const char * const XSD_STRING_DESC = "string";
Expand All @@ -188,7 +186,7 @@ CSoapMsgBuilder * CSoapMsgXsdBuilder::newMsgBuilder()
{
Owned<IPropertyTree>newXml = createPTree(m_structLabel.str());

IPropertyTreeIterator * itr = m_properties->getElements("*");
Owned<IPropertyTreeIterator> itr = m_properties->getElements("*");
itr->first();
while(itr->isValid())
{
Expand All @@ -208,7 +206,6 @@ CSoapMsgBuilder * CSoapMsgXsdBuilder::newMsgBuilder()
}
itr->next();
}
itr->Release();

StringBuffer xml;
return new CSoapMsgBuilder(toXML(newXml, xml).str());
Expand Down
21 changes: 5 additions & 16 deletions esp/platform/espcfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*
#endif
#endif

IPropertyTreeIterator *pt_iter = NULL;
Owned<IPropertyTreeIterator> pt_iter;
StringBuffer xpath;

if (m_inputs->hasProp("SingleUserPass"))
Expand All @@ -421,7 +421,7 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*
m_inputs->getProp("SingleUserPass", plainesppass);
encrypt(encesppass, plainesppass.str());
xpath.setf("SecurityManagers/SecurityManager[@type=\"SingleUserSecurityManager\"]/SingleUserSecurityManager/");
pt_iter = m_cfg->getElements(xpath.str());
pt_iter.setown(m_cfg->getElements(xpath.str()));
if (pt_iter!=NULL)
{
IPropertyTree *ptree = NULL;
Expand All @@ -442,8 +442,6 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*
}
pt_iter->next();
}
pt_iter->Release();
pt_iter=NULL;
}
}

Expand All @@ -470,7 +468,7 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*
xpath.clear();
xpath.append("EspService");

pt_iter = m_cfg->getElements(xpath.str());
pt_iter.setown(m_cfg->getElements(xpath.str()));

if (pt_iter!=NULL)
{
Expand All @@ -495,15 +493,12 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*
}
pt_iter->next();
}

pt_iter->Release();
pt_iter=NULL;
}

xpath.clear();
xpath.append("EspProtocol");

pt_iter = m_cfg->getElements(xpath.str());
pt_iter.setown(m_cfg->getElements(xpath.str()));

if (pt_iter!=NULL)
{
Expand All @@ -530,15 +525,12 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*

pt_iter->next();
}

pt_iter->Release();
pt_iter=NULL;
}

xpath.clear();
xpath.append("EspBinding");

pt_iter = m_cfg->getElements(xpath.str());
pt_iter.setown(m_cfg->getElements(xpath.str()));

if (pt_iter!=NULL)
{
Expand Down Expand Up @@ -588,9 +580,6 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*

pt_iter->next();
}

pt_iter->Release();
pt_iter=NULL;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/esdlcmd/esdl2ecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class Esdl2EclCmd : public EsdlConvertCmd
int count = trees.all->getCount("esxdl");
if (trees.all->getCount("esxdl") > 0)
{
IPropertyTree *file = trees.all->getPropTree("esxdl[1]");
Owned<IPropertyTree> file = trees.all->getPropTree("esxdl[1]");
if (file)
{
StringBuffer xmlfile;
Expand Down

0 comments on commit 4296177

Please sign in to comment.