Bug 88213 - [GTK] Memory leaks in DumpRenderTree.cpp
Summary: [GTK] Memory leaks in DumpRenderTree.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sudarsana Nagineni (babu)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-03 23:58 PDT by Sudarsana Nagineni (babu)
Modified: 2012-06-04 12:31 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.69 KB, patch)
2012-06-04 01:19 PDT, Sudarsana Nagineni (babu)
mrobinson: review-
Details | Formatted Diff | Diff
Patch (2.45 KB, patch)
2012-06-04 09:57 PDT, Sudarsana Nagineni (babu)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sudarsana Nagineni (babu) 2012-06-03 23:58:42 PDT
The following two memory leaks found in DumpRenderTree.cpp

==769== 10 bytes in 2 blocks are definitely lost in loss record 574 of 10,697
==769==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==769==    by 0xC5D2A38: g_malloc (gmem.c:159)
==769==    by 0xC5E7348: g_strndup (gstrfuncs.c:420)
==769==    by 0x45D4C7: dumpHistoryItem(_WebKitWebHistoryItem*, int, bool) (DumpRenderTree.cpp:278)
==769==    by 0x45D8B9: dumpBackForwardListForWebView(_WebKitWebView*) (DumpRenderTree.cpp:348)
==769==    by 0x45D91A: dumpBackForwardListForAllWebViews() (DumpRenderTree.cpp:359)
==769==    by 0x45E323: dump() (DumpRenderTree.cpp:564)
==769==    by 0x45F841: topLoadingFrameLoadFinished() (DumpRenderTree.cpp:1029)
==769==    by 0x45F97E: webFrameLoadStatusNotified(_WebKitWebFrame*, void*) (DumpRenderTree.cpp:1059)
==769==    by 0xC345CA1: g_closure_invoke (gclosure.c:777)
==769==    by 0xC356D70: signal_emit_unlocked_R (gsignal.c:3547)
==769==    by 0xC35F098: g_signal_emit_valist (gsignal.c:3296)
==769==    by 0xC35F241: g_signal_emit (gsignal.c:3352)
==769==    by 0xC34A956: g_object_dispatch_properties_changed (gobject.c:1041)
==769==    by 0xC34C232: g_object_notify (gobject.c:1133)
==769==    by 0x6CF2DC1: WebKit::notifyStatus(_WebKitWebFrame*, WebKitLoadStatus) (FrameLoaderClientGtk.cpp:130)
==769==    by 0x6CF2E59: WebKit::loadDone(_WebKitWebFrame*, bool) (FrameLoaderClientGtk.cpp:143)
==769==    by 0x6CF52BE: WebKit::FrameLoaderClient::dispatchDidFinishLoad() (FrameLoaderClientGtk.cpp:621)
==769==    by 0x74B3111: WebCore::FrameLoader::checkLoadCompleteForThisFrame() (FrameLoader.cpp:2112)
==769==    by 0x74B3D23: WebCore::FrameLoader::checkLoadComplete() (FrameLoader.cpp:2290)
==769==    by 0x749B077: WebCore::DocumentLoader::finishedLoading() (DocumentLoader.cpp:303)
==769==    by 0x74E79CA: WebCore::MainResourceLoader::didFinishLoading(double) (MainResourceLoader.cpp:544)
==769==    by 0x74F3332: WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*, double) (ResourceLoader.cpp:435)
==769==    by 0x769668B: WebCore::readCallback(_GObject*, _GAsyncResult*, void*) (ResourceHandleSoup.cpp:864)
==769==    by 0xC041918: async_ready_callback_wrapper (ginputstream.c:470)
==769==    by 0xC053F56: g_simple_async_result_complete (gsimpleasyncresult.c:767)
==769==    by 0xC053FD7: complete_in_idle_cb_for_thread (gsimpleasyncresult.c:835)
==769==    by 0xC5CCC99: g_main_context_dispatch (gmain.c:2515)
==769==    by 0xC5CD05F: g_main_context_iterate.isra.23 (gmain.c:3123)
==769==    by 0xC5CD459: g_main_loop_run (gmain.c:3317)
==769==    by 0xB3CE25C: gtk_main (gtkmain.c:1165)
==769==    by 0x45E97E: runTest(std::string const&) (DumpRenderTree.cpp:702)
==769==    by 0x46104A: main (DumpRenderTree.cpp:1388)



==769== 125 bytes in 1 blocks are definitely lost in loss record 8,905 of 10,697
==769==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==769==    by 0xD393A57: __vasprintf_chk (vasprintf_chk.c:82)
==769==    by 0xC607D7A: g_vasprintf (stdio2.h:199)
==769==    by 0xC5E745C: g_strdup_vprintf (gstrfuncs.c:509)
==769==    by 0xC5E74FB: g_strdup_printf (gstrfuncs.c:535)
==769==    by 0x45D2AC: dumpFramesAsText(_WebKitWebFrame*) (DumpRenderTree.cpp:244)
==769==    by 0x45D2EF: dumpFramesAsText(_WebKitWebFrame*) (DumpRenderTree.cpp:250)
==769==    by 0x45E198: dump() (DumpRenderTree.cpp:532)
==769==    by 0x45F841: topLoadingFrameLoadFinished() (DumpRenderTree.cpp:1029)
==769==    by 0x45F97E: webFrameLoadStatusNotified(_WebKitWebFrame*, void*) (DumpRenderTree.cpp:1059)
==769==    by 0xC345CA1: g_closure_invoke (gclosure.c:777)
==769==    by 0xC356D70: signal_emit_unlocked_R (gsignal.c:3547)
==769==    by 0xC35F098: g_signal_emit_valist (gsignal.c:3296)
==769==    by 0xC35F241: g_signal_emit (gsignal.c:3352)
==769==    by 0xC34A956: g_object_dispatch_properties_changed (gobject.c:1041)
==769==    by 0xC34C232: g_object_notify (gobject.c:1133)
==769==    by 0x6CF2DC1: WebKit::notifyStatus(_WebKitWebFrame*, WebKitLoadStatus) (FrameLoaderClientGtk.cpp:130)
==769==    by 0x6CF2E59: WebKit::loadDone(_WebKitWebFrame*, bool) (FrameLoaderClientGtk.cpp:143)
==769==    by 0x6CF52BE: WebKit::FrameLoaderClient::dispatchDidFinishLoad() (FrameLoaderClientGtk.cpp:621)
==769==    by 0x74B3111: WebCore::FrameLoader::checkLoadCompleteForThisFrame() (FrameLoader.cpp:2112)
==769==    by 0x74B3D23: WebCore::FrameLoader::checkLoadComplete() (FrameLoader.cpp:2290)
==769==    by 0x749B077: WebCore::DocumentLoader::finishedLoading() (DocumentLoader.cpp:303)
==769==    by 0x74E79CA: WebCore::MainResourceLoader::didFinishLoading(double) (MainResourceLoader.cpp:544)
==769==    by 0x74F3332: WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*, double) (ResourceLoader.cpp:435)
==769==    by 0x769668B: WebCore::readCallback(_GObject*, _GAsyncResult*, void*) (ResourceHandleSoup.cpp:864)
==769==    by 0xC041918: async_ready_callback_wrapper (ginputstream.c:470)
==769==    by 0xC053F56: g_simple_async_result_complete (gsimpleasyncresult.c:767)
==769==    by 0xC053FD7: complete_in_idle_cb_for_thread (gsimpleasyncresult.c:835)
==769==    by 0xC5CCC99: g_main_context_dispatch (gmain.c:2515)
==769==    by 0xC5CD05F: g_main_context_iterate.isra.23 (gmain.c:3123)
==769==    by 0xC5CD459: g_main_loop_run (gmain.c:3317)
==769==    by 0xB3CE25C: gtk_main (gtkmain.c:1165)
==769==    by 0x45E97E: runTest(std::string const&) (DumpRenderTree.cpp:702)
==769==    by 0x46104A: main (DumpRenderTree.cpp:1388)
Comment 1 Sudarsana Nagineni (babu) 2012-06-04 01:19:36 PDT
Created attachment 145534 [details]
Patch

Fixed memory leaks in DumpRenderTree.cpp.
Comment 2 Martin Robinson 2012-06-04 07:45:48 PDT
Comment on attachment 145534 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=145534&action=review

Looks good, though I think there should be one change...

> Tools/DumpRenderTree/gtk/DumpRenderTree.cpp:139
> +    g_free(string);

I think it makes sense for this function to accept a const char* as the second argument and have the caller responsible for cleaning up the string.
Comment 3 Sudarsana Nagineni (babu) 2012-06-04 09:57:30 PDT
Created attachment 145599 [details]
Patch

Fixed review comment #2.

Thanks for your review Martin.
Comment 4 WebKit Review Bot 2012-06-04 12:31:08 PDT
Comment on attachment 145599 [details]
Patch

Clearing flags on attachment: 145599

Committed r119416: <http://trac.webkit.org/changeset/119416>
Comment 5 WebKit Review Bot 2012-06-04 12:31:18 PDT
All reviewed patches have been landed.  Closing bug.