Skip to content

Commit

Permalink
Fix some memory leaks in the compiler
Browse files Browse the repository at this point in the history
Task-number: QTBUG-17770
Change-Id: I6d9d357bf529a9a3f414182fb6a818ddedda8e18
Reviewed-on: http://codereview.qt.nokia.com/2487
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
  • Loading branch information
Chris Adams authored and Qt by Nokia committed Sep 4, 2011
1 parent ae064a9 commit f22ae0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/declarative/qml/qdeclarativebinding.cpp
Expand Up @@ -243,6 +243,8 @@ QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeCont
cdata = typeData->compiledData();
}
QDeclarativeBinding *rv = cdata ? new QDeclarativeBinding(cdata->primitives.at(id), true, obj, ctxtdata, url, lineNumber, parent) : 0;
if (cdata)
cdata->release();
if (typeData)
typeData->release();
return rv;
Expand Down
2 changes: 2 additions & 0 deletions src/declarative/qml/qdeclarativeexpression.cpp
Expand Up @@ -256,6 +256,8 @@ QDeclarativeExpression::QDeclarativeExpression(const QDeclarativeScriptString &s
else
defaultConstruction = true;

if (cdata)
cdata->release();
if (typeData)
typeData->release();
}
Expand Down
Expand Up @@ -688,6 +688,8 @@ void tst_qdeclarativeecmascript::attachedProperties()
QCOMPARE(object->property("b").toInt(), 26);
QCOMPARE(object->property("c").toInt(), 26);
QCOMPARE(object->property("d").toInt(), 26);

delete object;
}

{
Expand Down

0 comments on commit f22ae0f

Please sign in to comment.