summaryrefslogtreecommitdiffstats
path: root/src/xml/dom
diff options
context:
space:
mode:
authorSami Rosendahl <ext-sami.1.rosendahl@nokia.com>2012-01-09 15:29:53 +0200
committerQt by Nokia <qt-info@nokia.com>2012-01-10 02:01:41 +0100
commitb6a43cfe9c136e298feaa8d48fc252fdb3d4e7c5 (patch)
tree57aee9e616ecc1be56c9a2aef685b195a1a1b6eb /src/xml/dom
parentacdd5fecb7075a4857f04f655da157b5ee1088c7 (diff)
Fix memory leak in QDomDocument entity text expansion
The created entity node's reference count needs to be decremented to 0 before it is added as a child, because appendChild will increment the reference count to correct value of 1. Re-enabled commented-out test data tst_QDom::setContent to exercise the code path with the leak. Change-Id: Ieb015d68ba9bbb3f20dd47e76835ad15abb1738e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/xml/dom')
-rw-r--r--src/xml/dom/qdom.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 25638717a0..3b1e2a8bb7 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -7457,6 +7457,7 @@ bool QDomHandler::characters(const QString& ch)
QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, 0, entityName,
QString(), QString(), QString()));
e->value = ch;
+ e->ref.deref();
doc->doctype()->appendChild(e.data());
e.take();
n.reset(doc->createEntityReference(entityName));