Bug 90790

Summary: [GTK] Fix memory leaks by adopting allocation of GdkPixbuf
Product: WebKit Reporter: Sudarsana Nagineni (babu) <naginenis>
Component: WebKitGTKAssignee: Sudarsana Nagineni (babu) <naginenis>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Sudarsana Nagineni (babu) 2012-07-09 07:55:59 PDT
Looks like GdkPixbuf returned by gdk_pixbuf_scale_simple() is leaking.

==6946== 1,104 (80 direct, 1,024 indirect) bytes in 1 blocks are definitely lost in loss record 52,728 of 55,380
==6946==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6946==    by 0xB963A38: g_malloc (gmem.c:159)
==6946==    by 0xB976C62: g_slice_alloc (gslice.c:1003)
==6946==    by 0xB9771A5: g_slice_alloc0 (gslice.c:1029)
==6946==    by 0xB6F78B9: g_type_create_instance (gtype.c:1872)
==6946==    by 0xB6DC0B8: g_object_constructor (gobject.c:1849)
==6946==    by 0xB6DD6E3: g_object_newv (gobject.c:1713)
==6946==    by 0xB6DDEC5: g_object_new_valist (gobject.c:1830)
==6946==    by 0xB6DE1D3: g_object_new (gobject.c:1545)
==6946==    by 0xF02AE2E: gdk_pixbuf_new_from_data (in /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0.2600.1)
==6946==    by 0xF028F9D: gdk_pixbuf_new (in /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0.2600.1)
==6946==    by 0xF030616: gdk_pixbuf_scale_simple (in /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0.2600.1)
==6946==    by 0x62CA5FC: getIconPixbufSynchronously(_WebKitFaviconDatabase*, WTF::String const&, WebCore::IntSize const&) (webkitfavicondatabase.cpp:410)
==6946==    by 0x62CA774: webkit_favicon_database_try_get_favicon_pixbuf (webkitfavicondatabase.cpp:445)
==6946==    by 0x62FB93E: webkit_web_view_try_get_favicon_pixbuf (webkitwebview.cpp:5224)
==6946==    by 0x404304: iconLoadedCb (main.c:202)
==6946==    by 0xB6D9C2F: g_cclosure_marshal_VOID__STRINGv (gmarshal.c:1004)
==6946==    by 0xB6D6EC9: _g_closure_invoke_va (gclosure.c:840)
==6946==    by 0xB6EF740: g_signal_emit_valist (gsignal.c:3207)
==6946==    by 0xB6F0241: g_signal_emit (gsignal.c:3352)
==6946==    by 0x62FBC64: webkitWebViewIconLoaded (webkitwebview.cpp:5302)
==6946==    by 0x62B648D: WebKit::FrameLoaderClient::dispatchDidReceiveIcon() (FrameLoaderClientGtk.cpp:779)
==6946==    by 0x6ABB9BD: WebCore::IconLoader::notifyFinished(WebCore::CachedResource*) (IconLoader.cpp:101)
Comment 1 Sudarsana Nagineni (babu) 2012-07-10 04:10:38 PDT
Found an another leak in RenderThemeGtk.cpp also. I'm going to fix both in a single patch.

==28864== 1,380 (400 direct, 980 indirect) bytes in 5 blocks are definitely lost in loss record 31,943 of 34,138
==28864==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28864==    by 0xB968A38: g_malloc (gmem.c:159)
==28864==    by 0xB97BC62: g_slice_alloc (gslice.c:1003)
==28864==    by 0xB97C1A5: g_slice_alloc0 (gslice.c:1029)
==28864==    by 0xB6FC8B9: g_type_create_instance (gtype.c:1872)
==28864==    by 0xB6E10B8: g_object_constructor (gobject.c:1849)
==28864==    by 0xB6E26E3: g_object_newv (gobject.c:1713)
==28864==    by 0xB6E2EC5: g_object_new_valist (gobject.c:1830)
==28864==    by 0xB6E31D3: g_object_new (gobject.c:1545)
==28864==    by 0xF045E2E: gdk_pixbuf_new_from_data (in /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0.2600.1)
==28864==    by 0xF043F9D: gdk_pixbuf_new (in /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0.2600.1)
==28864==    by 0xF04B616: gdk_pixbuf_scale_simple (in /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0.2600.1)
==28864==    by 0x775E502: WebCore::paintGdkPixbuf(WebCore::GraphicsContext*, _GdkPixbuf const*, WebCore::IntRect const&) (RenderThemeGtk.cpp:245)
==28864==    by 0x775EBB8: WebCore::RenderThemeGtk::paintSearchFieldCancelButton(WebCore::RenderObject*, WebCore::PaintInfo const&, WebCore::IntRect const&) (RenderThemeGtk.cpp:360)
==28864==    by 0x6E974FB: WebCore::RenderTheme::paint(WebCore::RenderObject*, WebCore::PaintInfo const&, WebCore::IntRect const&) (RenderTheme.cpp:366)
==28864==    by 0x6D784B1: WebCore::RenderBox::paintBoxDecorations(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBox.cpp:849)
==28864==    by 0x6D1D823: WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2896)
==28864==    by 0x6D1B4A7: WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2644)
==28864==    by 0x6D1D387: WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2854)
==28864==    by 0x6D1CF1B: WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2812)
==28864==    by 0x6D1D9A8: WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2920)
==28864==    by 0x6D1B4A7: WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2644)
==28864==    by 0x6D1D387: WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2854)
==28864==    by 0x6D1CF1B: WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2812)
==28864==    by 0x6D1D9A8: WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2920)
==28864==    by 0x6D1B4A7: WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&) (RenderBlock.cpp:2644)
Comment 2 Sudarsana Nagineni (babu) 2012-07-10 07:32:32 PDT
Created attachment 151460 [details]
Patch
Comment 3 WebKit Review Bot 2012-07-10 10:05:41 PDT
Comment on attachment 151460 [details]
Patch

Clearing flags on attachment: 151460

Committed r122233: <http://trac.webkit.org/changeset/122233>
Comment 4 WebKit Review Bot 2012-07-10 10:05:45 PDT
All reviewed patches have been landed.  Closing bug.