You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/06/06 06:13:44 UTC
[09/14] git commit: TS-1475: bad deallocator in XML utils
TS-1475: bad deallocator in XML utils
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/615026fa
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/615026fa
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/615026fa
Branch: refs/heads/3.3.x
Commit: 615026fafa7ff8b2261b6f10fc6afea7cec4b7da
Parents: b33a2a9
Author: James Peach <jp...@apache.org>
Authored: Wed Jun 5 13:42:04 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Jun 5 13:42:04 2013 -0700
----------------------------------------------------------------------
mgmt/utils/XmlUtils.cc | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/615026fa/mgmt/utils/XmlUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/utils/XmlUtils.cc b/mgmt/utils/XmlUtils.cc
index 599a7e9..282f272 100644
--- a/mgmt/utils/XmlUtils.cc
+++ b/mgmt/utils/XmlUtils.cc
@@ -297,7 +297,7 @@ AppendStr(char *p1, const char *p2)
if (p1) {
memcpy(p, p1, nLen1);
- delete p1;
+ delete[] p1;
}
memcpy(p + nLen1, p2, nLen2);
p[nLen1 + nLen2] = 0;
@@ -341,23 +341,21 @@ XMLNode::getXML()
while (pChild) {
char *pChildXML = pChild->getXML();
if (!pChildXML) {
- if (pBody)
- delete[]pBody;
+ delete[] pBody;
return NULL;
}
pBody = AppendStr(pBody, pChildXML);
- delete pChildXML;
+ delete[] pChildXML;
pChild = pChild->m_pNext;
}
char *pAttr = getAttributeString();
char *pRet = ConstructXMLBlock(m_pNodeName, pBody, pAttr);
- if (pBody)
- delete[]pBody;
- if (pAttr)
- delete[]pAttr;
+
+ delete[] pBody;
+ delete[] pAttr;
return pRet;
}