Uic: Fix memory leaks

Fix some memory leaks in uic. These break the Qt build with clangs
address sanitizer feature enabled as Clang will cause uic to fail when
it detects these leaks. This in turn will stop the Qt build.

Change-Id: I6794b29f5a36fc8a2d59cf36f6d7459f3f50d56d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
Tobias Hunger 2014-08-22 13:31:02 +02:00
parent ec5f402cfd
commit 627657217e
1 changed files with 12 additions and 4 deletions

View File

@ -921,6 +921,7 @@ void WriteInitialization::acceptLayout(DomLayout *node)
m_layoutMarginType = SubLayoutMargin;
DomPropertyList propList = node->elementProperty();
DomPropertyList newPropList;
if (m_layoutWidget) {
bool left, top, right, bottom;
left = top = right = bottom = false;
@ -940,31 +941,38 @@ void WriteInitialization::acceptLayout(DomLayout *node)
DomProperty *p = new DomProperty();
p->setAttributeName(QLatin1String("leftMargin"));
p->setElementNumber(0);
propList.append(p);
newPropList.append(p);
}
if (!top) {
DomProperty *p = new DomProperty();
p->setAttributeName(QLatin1String("topMargin"));
p->setElementNumber(0);
propList.append(p);
newPropList.append(p);
}
if (!right) {
DomProperty *p = new DomProperty();
p->setAttributeName(QLatin1String("rightMargin"));
p->setElementNumber(0);
propList.append(p);
newPropList.append(p);
}
if (!bottom) {
DomProperty *p = new DomProperty();
p->setAttributeName(QLatin1String("bottomMargin"));
p->setElementNumber(0);
propList.append(p);
newPropList.append(p);
}
m_layoutWidget = false;
}
propList.append(newPropList);
writeProperties(varName, className, propList, WritePropertyIgnoreMargin|WritePropertyIgnoreSpacing);
// Clean up again:
propList.clear();
qDeleteAll(newPropList);
newPropList.clear();
m_layoutChain.push(node);
TreeWalker::acceptLayout(node);
m_layoutChain.pop();