From 89909503754be7bdd123b9f1864edf99a81a47d3 Mon Sep 17 00:00:00 2001
From: Khaled Noaman <knoaman@apache.org>
Date: Wed, 11 Aug 2004 21:08:31 +0000
Subject: [PATCH] Fixing Xerces-C crash when creating a MixedContentModel.
 Patch by  Andrew Fang.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175987 13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/validators/common/MixedContentModel.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/xercesc/validators/common/MixedContentModel.cpp b/src/xercesc/validators/common/MixedContentModel.cpp
index ddac204cd..d07ccb186 100644
--- a/src/xercesc/validators/common/MixedContentModel.cpp
+++ b/src/xercesc/validators/common/MixedContentModel.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.11  2004/08/11 21:08:31  knoaman
+ * Fixing Xerces-C crash when creating a MixedContentModel. Patch by  Andrew Fang.
+ *
  * Revision 1.10  2004/01/29 11:51:21  cargilld
  * Code cleanup changes to get rid of various compiler diagnostic messages.
  *
@@ -210,13 +213,16 @@ MixedContentModel::MixedContentModel(const bool             dtd
         fCount * sizeof(ContentSpecNode::NodeTypes)
     ); //new ContentSpecNode::NodeTypes[fCount];
     for (unsigned int index = 0; index < fCount; index++) {
-        fChildren[index] = children.elementAt(index);
+        fChildren[index] = new (fMemoryManager) QName(*children.elementAt(index));
         fChildTypes[index] = childTypes.elementAt(index);
     }
 }
 
 MixedContentModel::~MixedContentModel()
 {
+    for (unsigned int index = 0; index < fCount; index++) {
+        delete fChildren[index];
+    }
     fMemoryManager->deallocate(fChildren); //delete [] fChildren;
     fMemoryManager->deallocate(fChildTypes); //delete [] fChildTypes;
 }
-- 
GitLab