WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
7805
LEAK: method name leaks in KJS::Bindings::CInstance::invokeMethod
https://bugs.webkit.org/show_bug.cgi?id=7805
Summary
LEAK: method name leaks in KJS::Bindings::CInstance::invokeMethod
Alexey Proskuryakov
Reported
2006-03-16 10:15:09 PST
A leak observed on BuildBot: Leak: 0x106d6c90 size=16 string 'getURL' Call stack: [thread 24a7]: | 0x0 | start | _start | main | dumpRenderTree | -[NSRunLoop runMode:beforeDate:] | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSources0 | _sendCallbacks | -[NSURLConnection(NSURLConnectionInternal) _sendCallbacks] | -[NSURLConnection(NSURLConnectionInternal) _sendDidReceiveDataCallback] | -[WebLoader connection:didReceiveData:lengthReceived:] | -[WebMainResourceLoader didReceiveData:lengthReceived:] | -[WebLoader didReceiveData:lengthReceived:] | -[WebMainResourceLoader addData:] | -[WebDataSource(WebPrivate) _receivedData:] | -[WebDataSource(WebPrivate) _commitLoadWithData:] | -[WebHTMLRepresentation receivedData:withDataSource:] | -[WebFrameBridge receivedData:textEncodingName:] | -[WebCoreFrameBridge addData:] | WebCore::Frame::addData(char const*, int) | WebCore::Frame::write(char const*, int) | WebCore::HTMLTokenizer::write(WebCore::SegmentedString const&, bool) | WebCore::HTMLTokenizer::parseTag(WebCore::SegmentedString&, WebCore::HTMLTokenizer::State) | WebCore::HTMLTokenizer::parseSpecial(WebCore::SegmentedString&, WebCore::HTMLTokenizer::State) | WebCore::HTMLTokenizer::scriptHandler(WebCore::HTMLTokenizer::State) | WebCore::HTMLTokenizer::scriptExecution(QString const&, WebCore::HTMLTokenizer::State, QString, int) | WebCore::Frame::executeScript(QString const&, int, WebCore::NodeImpl*, QString const&) | WebCore::KJSProxyImpl::evaluate(WebCore::String const&, int, WebCore::String const&, WebCore::NodeImpl*) | KJS::Interpreter::evaluate(KJS::UString const&, int, KJS::UChar const*, int, KJS::JSValue*) | KJS::InterpreterImp::evaluate(KJS::UChar const*, int, KJS::JSValue*, KJS::UString const&, int) | KJS::BlockNode::execute(KJS::ExecState*) | KJS::SourceElementsNode::execute(KJS::ExecState*) | KJS::TryNode::execute(KJS::ExecState*) | KJS::BlockNode::execute(KJS::ExecState*) | KJS::SourceElementsNode::execute(KJS::ExecState*) | KJS::IfNode::execute(KJS::ExecState*) | KJS::BlockNode::execute(KJS::ExecState*) | KJS::SourceElementsNode::execute(KJS::ExecState*) | KJS::IfNode::execute(KJS::ExecState*) | KJS::BlockNode::execute(KJS::ExecState*) | KJS::SourceElementsNode::execute(KJS::ExecState*) | KJS::ExprStatementNode::execute(KJS::ExecState*) | KJS::FunctionCallDotNode::evaluate(KJS::ExecState*) | KJS::JSObject::call(KJS::ExecState*, KJS::JSObject*, KJS::List const&) | KJS::RuntimeMethod::callAsFunction(KJS::ExecState*, KJS::JSObject*, KJS::List const&) | KJS::Bindings::CInstance::invokeMethod(KJS::ExecState*, KJS::Bindings::MethodList const&, KJS::List const&) | KJS::Bindings::CMethod::name() const | _NPN_UTF8FromIdentifier | strdup
Attachments
proposed fix
(1.96 KB, patch)
2006-03-16 10:24 PST
,
Alexey Proskuryakov
no flags
Details
Formatted Diff
Diff
a patch that includes my fix for this leak
(66.16 KB, patch)
2006-03-16 12:27 PST
,
Darin Adler
mjs
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2006-03-16 10:24:37 PST
Created
attachment 7114
[details]
proposed fix
Geoffrey Garen
Comment 2
2006-03-16 12:08:40 PST
Comment on
attachment 7114
[details]
proposed fix Nice fix. I really wish the method/field weren't responsible for deleting this data. What if a caller wanted to hang on to it past the method's/field's lifetime? Still, in practice that doesn't seem to happen, and this is the idiom used in the rest of the bindings code, so I think it's the right fix.
Darin Adler
Comment 3
2006-03-16 12:27:01 PST
I also noticed this leak. But when I went to fix this leak I went crazy and also fixed a lot of other things. We should land Alexey's patch.
Darin Adler
Comment 4
2006-03-16 12:27:32 PST
Created
attachment 7117
[details]
a patch that includes my fix for this leak
Darin Adler
Comment 5
2006-03-16 12:28:58 PST
Actually, although my patch has lots of other fixes, the fix for the leak is better. There no need to allocate and then later destroy a string. We can just use the pointer to the string that exists inside the private identifier. Here's an excerpt from mine: +const char* CMethod::name() const +{ + PrivateIdentifier *i = (PrivateIdentifier *)_methodIdentifier; + return i->isString ? i->value.string : 0; +}
Alexey Proskuryakov
Comment 6
2006-03-18 03:15:56 PST
Comment on
attachment 7114
[details]
proposed fix Most importantly, my patch is simply wrong - it still leaks the name. Didn't clean up properly when moving from char* to CString...
John Sullivan
Comment 7
2006-03-20 18:41:48 PST
Comment on
attachment 7117
[details]
a patch that includes my fix for this leak I almost reviewed this, but got scared away by (1) the many style changes hiding the few (one? I gave up trying to find them) substantive changes; (2) the lack of ChangeLog explaining what substantive changes I should be looking for.
Maciej Stachowiak
Comment 8
2006-03-22 21:43:57 PST
Comment on
attachment 7117
[details]
a patch that includes my fix for this leak Per sullivan's comment, please add a ChangeLog entry explaining the substantial change - I couldn't find it either.
Darin Adler
Comment 9
2006-03-23 07:29:32 PST
The reason the patch doesn't have a change log is that I wasn't really ready to submit it for review. I attached it to demonstrate the leak fix within and then Geoff set the review flag. I decided to set the review flag myself to make it clear I had made the code change, but I haven't done my usual steps to prepare to land a code change yet.
Geoffrey Garen
Comment 10
2006-03-23 09:39:58 PST
Sorry. My bad.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug