RESOLVED FIXED 37584
LEAK: in ThreadableWebSocketChannel::create()
https://bugs.webkit.org/show_bug.cgi?id=37584
Summary LEAK: in ThreadableWebSocketChannel::create()
Shinichiro Hamaji
Reported 2010-04-14 10:14:55 PDT
Call stack: [thread 0xb0227000]: | thread_start | _pthread_start | __ZN3WTFL16threadEntryPointEPv | WebCore::WorkerThread::workerThreadStart(void*) | WebCore::WorkerThread::workerThread() | WebCore::WorkerScriptController::evaluate(WebCore::ScriptSourceCode const&) | WebCore::WorkerScriptController::evaluate(We bCore::ScriptSourceCode const&, WebCore::ScriptValue*) | JSC::evaluate(JSC::ExecState*, JSC::ScopeChain&, JSC::SourceCode const&, JSC::JSValue) | JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::ScopeChainNode*, JSC: :JSObject*, JSC::JSValue*) | JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*, JSC::JSValue*) | jscGeneratedNativeCode | cti_op_construct_NotJSConstruct | __ZN7WebCoreL18constructWebSocketEPN3JSC9ExecStateEPNS0_ 8JSObjectERKNS0_7ArgListE | WebCore::WebSocket::connect(WebCore::KURL const&, int&) | WebCore::WebSocket::connect(WebCore::KURL const&, WebCore::String const&, int&) | WebCore::ThreadableWebSocketChannel::create(WebCore::ScriptExecutionContext*, WebCore::WebSocketChannelClient*, WebCore::KURL const&, WebCore::String const&) | WebCore::String::append(WebCore::String const&) | WebCore::StringImpl::c reateUninitialized(unsigned int, unsigned short*&) | WTF::fastMalloc(unsigned long) | malloc | malloc_zone_malloc Looks like WorkerThreadableWebSocketChannel::Bridge isn't freed.
Attachments
Patch v1 (1.44 KB, patch)
2010-04-14 10:16 PDT, Shinichiro Hamaji
no flags
Patch v2 (2.88 KB, patch)
2010-04-14 11:33 PDT, Shinichiro Hamaji
levin: review+
Shinichiro Hamaji
Comment 1 2010-04-14 10:16:36 PDT
Created attachment 53343 [details] Patch v1
Fumitoshi Ukai
Comment 2 2010-04-14 10:24:06 PDT
(In reply to comment #1) > Created an attachment (id=53343) [details] > Patch v1 LGTM. Thanks!
David Levin
Comment 3 2010-04-14 11:15:00 PDT
Comment on attachment 53343 [details] Patch v1 > diff --git a/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp b/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp > index 3dda104..d99efaa 100644 > --- a/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp > +++ b/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp > @@ -52,7 +52,7 @@ namespace WebCore { > WorkerThreadableWebSocketChannel::WorkerThreadableWebSocketChannel(WorkerContext* context, WebSocketChannelClient* client, const String& taskMode, const KURL& url, const String& protocol) > : m_workerContext(context) > , m_workerClientWrapper(ThreadableWebSocketChannelClientWrapper::create(client)) > - , m_bridge(new Bridge(m_workerClientWrapper, m_workerContext, taskMode, url, protocol)) > + , m_bridge(adoptRef(new Bridge(m_workerClientWrapper, m_workerContext, taskMode, url, protocol))) The standard way to do this is to make the constructor private and make a static create method which does the adoptRef and returns a PassRefPtr.
Shinichiro Hamaji
Comment 4 2010-04-14 11:33:17 PDT
Created attachment 53348 [details] Patch v2
Fumitoshi Ukai
Comment 5 2010-04-14 16:42:35 PDT
(In reply to comment #4) > Created an attachment (id=53348) [details] > Patch v2 Looks good! I believe no other class in websockets does the same mistake.
David Levin
Comment 6 2010-04-14 23:53:46 PDT
Comment on attachment 53348 [details] Patch v2 Your Changelog doesn't reflect your change now. (It seems to be missing the recent changes.) so please do a minor update on that and submit this. Thanks!
Shinichiro Hamaji
Comment 7 2010-04-15 07:52:28 PDT
Shinichiro Hamaji
Comment 8 2010-04-15 08:26:19 PDT
Oops. I fixed the ChangeLog entry before I landed. Thanks for your review!
Note You need to log in before you can comment on or make changes to this bug.