trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject git commit: TS-1475: bad deallocator in XML utils
Date Wed, 05 Jun 2013 20:42:15 GMT
Updated Branches:
  refs/heads/master b33a2a950 -> 615026faf


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/master
Commit: 615026fafa7ff8b2261b6f10fc6afea7cec4b7da
Parents: b33a2a9
Author: James Peach <jpeach@apache.org>
Authored: Wed Jun 5 13:42:04 2013 -0700
Committer: James Peach <jpeach@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;
 }


Mime
View raw message