Changeset 57626 in webkit
- Timestamp:
- Apr 14, 2010 8:07:49 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r57625 r57626 1 2010-04-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 Fix a few memory leaks in QScriptEngine. 6 7 Syntax checking caused memory leak, not all temporary variables were released. 8 9 [Qt] Syntax checking in the QtScript cause a memory leak. 10 https://bugs.webkit.org/show_bug.cgi?id=37610 11 12 * qt/api/qscriptengine_p.cpp: 13 (QScriptEnginePrivate::checkSyntax): 14 * qt/api/qscriptsyntaxcheckresult.cpp: 15 (QScriptSyntaxCheckResultPrivate::errorMessage): 16 (QScriptSyntaxCheckResultPrivate::errorLineNumber): 17 1 18 2010-04-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> 2 19 -
trunk/JavaScriptCore/qt/api/qscriptengine_p.cpp
r56686 r57626 43 43 { 44 44 JSValueRef exception; 45 if (JSCheckScriptSyntax(m_context, QScriptConverter::toString(program), /* url */ 0, /* starting line */ 1, &exception)) 45 JSStringRef source = QScriptConverter::toString(program); 46 bool syntaxIsCorrect = JSCheckScriptSyntax(m_context, source, /* url */ 0, /* starting line */ 1, &exception); 47 JSStringRelease(source); 48 if (syntaxIsCorrect) { 46 49 return new QScriptSyntaxCheckResultPrivate(this); 50 } 47 51 JSValueProtect(m_context, exception); 48 52 return new QScriptSyntaxCheckResultPrivate(this, const_cast<JSObjectRef>(exception)); -
trunk/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
r56333 r57626 125 125 QString QScriptSyntaxCheckResultPrivate::errorMessage() const 126 126 { 127 if (m_exception) 128 return QScriptConverter::toString(JSValueToStringCopy(m_engine->context(), m_exception, /* exception */ 0)); 129 return QString(); 127 if (!m_exception) 128 return QString(); 129 130 JSStringRef tmp = JSValueToStringCopy(m_engine->context(), m_exception, /* exception */ 0); 131 QString message = QScriptConverter::toString(tmp); 132 JSStringRelease(tmp); 133 return message; 130 134 } 131 135 … … 135 139 return -1; 136 140 // m_exception is an instance of the Exception so it has "line" attribute. 141 JSStringRef lineAttrName = QScriptConverter::toString("line"); 137 142 JSValueRef line = JSObjectGetProperty(m_engine->context(), 138 143 m_exception, 139 QScriptConverter::toString("line"),144 lineAttrName, 140 145 /* exceptions */0); 146 JSStringRelease(lineAttrName); 141 147 return JSValueToNumber(m_engine->context(), line, /* exceptions */0); 142 148 }
Note: See TracChangeset
for help on using the changeset viewer.