summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-18 13:00:21 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-18 17:35:22 +0000
commitaf22ccf5605c6b7b20b845fb2b4003d3f56d8bc9 (patch)
tree459d596f0f0711dbc8fb2cc6b5f6f0d8c3385944 /src/xml
parent1dbaf037a816b2a38d79628d3abd73f138f9fd80 (diff)
Fix a double deletion in QDomAttr::setNodeValue()
Check the reference count before deleting. Patch as contributed on bug report. Pick-to: 5.15 5.12 Fixes: QTBUG-86547 Change-Id: I2cb197e3eeda7ade2442c23f6b4f1ae6ff2ff810 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/dom/qdom.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 571e7fb0ac..43e9034ee9 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -3625,7 +3625,9 @@ void QDomAttrPrivate::setNodeValue(const QString& v)
// keep the refcount balanced: appendChild() does a ref anyway.
t->ref.deref();
if (first) {
- delete removeChild(first);
+ auto removed = removeChild(first);
+ if (removed && !removed->ref)
+ delete removed;
}
appendChild(t);
}