Bug 116222

Summary: [GTK] Fix memory leak in WebKitBackForwardList
Product: WebKit Reporter: Manuel Rego Casasnovas <rego>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue, gustavo, mrobinson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Manuel Rego Casasnovas 2013-05-16 07:24:44 PDT
Valgrind traces show memory leak in WebKitBackForwardList::webkit_back_forward_list_get_forward_list() where the ImmutableArray is not been released.

The full trace:
    ==9902== 64 bytes in 2 blocks are definitely lost in loss record 5,228 of 8,400
    ==9902==    at 0x4C2A26B: malloc (vg_replace_malloc.c:270)
    ==9902==    by 0xDB174C8: WTF::fastMalloc(unsigned long) (FastMalloc.cpp:286)
    ==9902==    by 0x53A5D30: WTF::ThreadSafeRefCountedBase::operator new(unsigned long) (ThreadSafeRefCounted.h:72)
    ==9902==    by 0x53C578F: WebKit::ImmutableArray::create() (ImmutableArray.h:44)
    ==9902==    by 0x54C5A34: WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit(unsigned int) const (WebBackForwardList.cpp:213)
    ==9902==    by 0x541918D: webkit_back_forward_list_get_back_list_with_limit (WebKitBackForwardList.cpp:255)
    ==9902==    by 0x40ABFF: browserWindowUpdateNavigationActions (BrowserWindow.c:222)
    ==9902==    by 0x40ACDA: backForwadlistChanged (BrowserWindow.c:235)
    ==9902==    by 0x56ACF86: webkit_marshal_VOID__OBJECT_POINTER (WebKitMarshal.cpp:520)
    ==9902==    by 0xC40E09F: g_closure_invoke (gclosure.c:777)
    ==9902==    by 0xC41F82F: signal_emit_unlocked_R (gsignal.c:3584)
    ==9902==    by 0xC427619: g_signal_emit_valist (gsignal.c:3328)
    ==9902==    by 0xC4278A1: g_signal_emit (gsignal.c:3384)
    ==9902==    by 0x5418C21: webkitBackForwardListChanged(_WebKitBackForwardList*, WebKit::WebBackForwardListItem*, WebKit::ImmutableArray*) (WebKitBackForwardList.cpp:144)
    ==9902==    by 0x542E96A: didChangeBackForwardList(OpaqueWKPage const*, OpaqueWKBackForwardListItem const*, OpaqueWKArray const*, void const*) (WebKitLoaderClient.cpp:128)
    ==9902==    by 0x54F7A31: WebKit::WebLoaderClient::didChangeBackForwardList(WebKit::WebPageProxy*, WebKit::WebBackForwardListItem*, WTF::Vector<WTF::RefPtr<WebKit::APIObject>, 0ul, WTF::CrashOnOverflow>*) (W
    ==9902==    by 0x5502525: WebKit::WebPageProxy::didChangeBackForwardList(WebKit::WebBackForwardListItem*, WTF::Vector<WTF::RefPtr<WebKit::APIObject>, 0ul, WTF::CrashOnOverflow>*) (WebPageProxy.cpp:874)
    ==9902==    by 0x54C5301: WebKit::WebBackForwardList::addItem(WebKit::WebBackForwardListItem*) (WebBackForwardList.cpp:130)
    ==9902==    by 0x550B589: WebKit::WebPageProxy::backForwardAddItem(unsigned long) (WebPageProxy.cpp:3026)
    ==9902==    by 0x569044E: void CoreIPC::callMemberFunction<WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long), unsigned long>(CoreIPC::Arguments1<unsigned long> const&, WebKit::WebPageProxy*
Comment 1 Manuel Rego Casasnovas 2013-05-16 07:32:57 PDT
Created attachment 201955 [details]
Patch
Comment 2 WebKit Commit Bot 2013-05-16 07:33:53 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Carlos Garcia Campos 2013-05-16 09:22:55 PDT
Comment on attachment 201955 [details]
Patch

This correct, thanks!
Comment 4 WebKit Commit Bot 2013-05-16 19:49:52 PDT
Comment on attachment 201955 [details]
Patch

Clearing flags on attachment: 201955

Committed r150232: <http://trac.webkit.org/changeset/150232>
Comment 5 WebKit Commit Bot 2013-05-16 19:49:55 PDT
All reviewed patches have been landed.  Closing bug.