Bug 118248

Summary: [ATK] Leak: leaks in WebKitAccessibleInterfaceText
Product: WebKit Reporter: Brian Holt <brian.holt>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, cdumez, cfleizach, commit-queue, dmazzoni, eflews.bot, gtk-ews, gyuyoung.kim, jdiggs, mario, philn, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 116317    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Final patch none

Description Brian Holt 2013-07-01 08:26:51 PDT
In Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp

Leaks found using the "--leak" option in the Gtk port:

{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   fun:malloc
   fun:realloc
   fun:g_realloc
   fun:g_string_maybe_expand
   fun:g_string_sized_new
   fun:_ZL13textForObjectPN7WebCore19AccessibilityObjectE
   fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii
   fun:_ZN22AccessibilityUIElement11stringValueEv
   fun:_ZL22getStringValueCallbackPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS2_
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE14getStaticValueEPNS_9ExecStateENS_12PropertyNameE
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateENS_12PropertyNameERNS_12PropertySlotE
   fun:llint_slow_path_get_by_id
   obj:/home/likewise-open/SERILOCAL/brian.holt/Code/gnome3/WebKit/WebKitBuild/Release/.libs/libjavascriptcoregtk-3.0.so.0.14.1
   fun:_ZN3JSC11Interpreter7executeEPNS_14EvalExecutableEPNS_9ExecStateENS_7JSValueEPNS_7JSScopeE
   fun:_ZN3JSC4evalEPNS_9ExecStateE
   fun:cti_op_call_eval
   obj:*
   fun:_ZN3JSC11Interpreter7executeEPNS_17ProgramExecutableEPNS_9ExecStateEPNS_8JSObjectE
   fun:_ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueEPS5_
   fun:_ZN7WebCore16ScriptController15evaluateInWorldERKNS_16ScriptSourceCodeEPNS_15DOMWrapperWorldE
   fun:_ZN7WebCore16ScriptController8evaluateERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13executeScriptERKNS_16ScriptSourceCodeE
}

{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   fun:malloc
   fun:g_malloc
   fun:g_strdup
   fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii
   fun:_ZL23webkitAccessibleGetNameP10_AtkObject
   fun:_ZN22AccessibilityUIElement5titleEv
   fun:_ZL16getTitleCallbackPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS2_
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE14getStaticValueEPNS_9ExecStateENS_12PropertyNameE
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateENS_12PropertyNameERNS_12PropertySlotE
   fun:llint_slow_path_get_by_id
   obj:/home/likewise-open/SERILOCAL/brian.holt/Code/gnome3/WebKit/WebKitBuild/Release/.libs/libjavascriptcoregtk-3.0.so.0.14.1
   fun:_ZN3JSC11Interpreter7executeEPNS_14EvalExecutableEPNS_9ExecStateENS_7JSValueEPNS_7JSScopeE
   fun:_ZN3JSC4evalEPNS_9ExecStateE
   fun:llint_slow_path_call_eval
   obj:/home/likewise-open/SERILOCAL/brian.holt/Code/gnome3/WebKit/WebKitBuild/Release/.libs/libjavascriptcoregtk-3.0.so.0.14.1
   fun:_ZN3JSC11Interpreter7executeEPNS_17ProgramExecutableEPNS_9ExecStateEPNS_8JSObjectE
   fun:_ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueEPS5_
   fun:_ZN7WebCore16ScriptController15evaluateInWorldERKNS_16ScriptSourceCodeEPNS_15DOMWrapperWorldE
   fun:_ZN7WebCore16ScriptController20executeScriptInWorldEPNS_15DOMWrapperWorldERKN3WTF6StringEb
   fun:_ZN7WebCore15ScheduledAction7executeEPNS_8DocumentE
   fun:_ZN7WebCore8DOMTimer5firedEv
   fun:_ZN7WebCore12ThreadTimers24sharedTimerFiredInternalEv
}

{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   fun:realloc
   fun:g_realloc
   fun:g_string_maybe_expand
   fun:g_string_insert_len
   fun:_ZL15textForRendererPN7WebCore12RenderObjectE
   fun:_ZL15textForRendererPN7WebCore12RenderObjectE
   fun:_ZL15textForRendererPN7WebCore12RenderObjectE
   fun:_ZL13textForObjectPN7WebCore19AccessibilityObjectE
   fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii
   fun:_ZN22AccessibilityUIElement11stringValueEv
   fun:_ZL22getStringValueCallbackPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS2_
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE14getStaticValueEPNS_9ExecStateENS_12PropertyNameE
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateENS_12PropertyNameERNS_12PropertySlotE
   fun:llint_slow_path_get_by_id
   obj:/home/likewise-open/SERILOCAL/brian.holt/Code/gnome3/WebKit/WebKitBuild/Release/.libs/libjavascriptcoregtk-3.0.so.0.14.1
   fun:_ZN3JSC11Interpreter7executeEPNS_17ProgramExecutableEPNS_9ExecStateEPNS_8JSObjectE
   fun:_ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueEPS5_
   fun:_ZN7WebCore16ScriptController15evaluateInWorldERKNS_16ScriptSourceCodeEPNS_15DOMWrapperWorldE
   fun:_ZN7WebCore16ScriptController8evaluateERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13executeScriptERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13prepareScriptERKN3WTF12TextPositionENS0_17LegacyTypeSupportE
   fun:_ZN7WebCore16HTMLScriptRunner9runScriptEPNS_7ElementERKN3WTF12TextPositionE
}

{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   fun:malloc
   fun:realloc
   fun:g_realloc
   fun:g_string_maybe_expand
   fun:g_string_sized_new
   fun:_ZL13textForObjectPN7WebCore19AccessibilityObjectE
   fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii
   fun:_ZN22AccessibilityUIElement11stringValueEv
   fun:_ZL22getStringValueCallbackPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS2_
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE14getStaticValueEPNS_9ExecStateENS_12PropertyNameE
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateENS_12PropertyNameERNS_12PropertySlotE
   fun:llint_slow_path_get_by_id
   obj:/home/likewise-open/SERILOCAL/brian.holt/Code/gnome3/WebKit/WebKitBuild/Release/.libs/libjavascriptcoregtk-3.0.so.0.14.1
   fun:_ZN3JSC11Interpreter7executeEPNS_17ProgramExecutableEPNS_9ExecStateEPNS_8JSObjectE
   fun:_ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueEPS5_
   fun:_ZN7WebCore16ScriptController15evaluateInWorldERKNS_16ScriptSourceCodeEPNS_15DOMWrapperWorldE
   fun:_ZN7WebCore16ScriptController8evaluateERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13executeScriptERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13prepareScriptERKN3WTF12TextPositionENS0_17LegacyTypeSupportE
   fun:_ZN7WebCore16HTMLScriptRunner9runScriptEPNS_7ElementERKN3WTF12TextPositionE
   fun:_ZN7WebCore16HTMLScriptRunner7executeEN3WTF10PassRefPtrINS_7ElementEEERKNS1_12TextPositionE
   fun:_ZN7WebCore18HTMLDocumentParser30runScriptsForPausedTreeBuilderEv
}
{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   fun:realloc
   fun:g_realloc
   fun:g_string_maybe_expand
   fun:g_string_insert_len
   fun:_ZL13textForObjectPN7WebCore19AccessibilityObjectE
   fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii
   fun:_ZN22AccessibilityUIElement11stringValueEv
   fun:_ZL22getStringValueCallbackPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS2_
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE14getStaticValueEPNS_9ExecStateENS_12PropertyNameE
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateENS_12PropertyNameERNS_12PropertySlotE
   fun:_ZNK3JSC7JSValue3getEPNS_9ExecStateENS_12PropertyNameERNS_12PropertySlotE
   fun:cti_op_get_by_id_generic
   obj:*
   fun:_ZN3JSC11Interpreter7executeEPNS_14EvalExecutableEPNS_9ExecStateENS_7JSValueEPNS_7JSScopeE
   fun:_ZN3JSC4evalEPNS_9ExecStateE
   fun:cti_op_call_eval
   obj:*
   fun:_ZN3JSC11Interpreter7executeEPNS_17ProgramExecutableEPNS_9ExecStateEPNS_8JSObjectE
   fun:_ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueEPS5_
   fun:_ZN7WebCore16ScriptController15evaluateInWorldERKNS_16ScriptSourceCodeEPNS_15DOMWrapperWorldE
   fun:_ZN7WebCore16ScriptController8evaluateERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13executeScriptERKNS_16ScriptSourceCodeE
}

{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   fun:realloc
   fun:g_realloc
   fun:g_string_maybe_expand
   fun:g_string_insert_len
   fun:_ZL13textForObjectPN7WebCore19AccessibilityObjectE
   fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii
   fun:_ZN22AccessibilityUIElement11stringValueEv
   fun:_ZL22getStringValueCallbackPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS2_
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE14getStaticValueEPNS_9ExecStateENS_12PropertyNameE
   fun:_ZN3JSC16JSCallbackObjectINS_20JSDestructibleObjectEE18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateENS_12PropertyNameERNS_12PropertySlotE
   fun:llint_slow_path_get_by_id
   obj:/home/likewise-open/SERILOCAL/brian.holt/Code/gnome3/WebKit/WebKitBuild/Release/.libs/libjavascriptcoregtk-3.0.so.0.14.1
   fun:_ZN3JSC11Interpreter7executeEPNS_17ProgramExecutableEPNS_9ExecStateEPNS_8JSObjectE
   fun:_ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueEPS5_
   fun:_ZN7WebCore16ScriptController15evaluateInWorldERKNS_16ScriptSourceCodeEPNS_15DOMWrapperWorldE
   fun:_ZN7WebCore16ScriptController8evaluateERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13executeScriptERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13prepareScriptERKN3WTF12TextPositionENS0_17LegacyTypeSupportE
   fun:_ZN7WebCore16HTMLScriptRunner9runScriptEPNS_7ElementERKN3WTF12TextPositionE
   fun:_ZN7WebCore16HTMLScriptRunner7executeEN3WTF10PassRefPtrINS_7ElementEEERKNS1_12TextPositionE
   fun:_ZN7WebCore18HTMLDocumentParser30runScriptsForPausedTreeBuilderEv
   fun:_ZN7WebCore18HTMLDocumentParser16canTakeNextTokenENS0_15SynchronousModeERNS_11PumpSessionE
}
Comment 1 Brian Holt 2013-07-01 08:50:37 PDT
Created attachment 205814 [details]
Patch
Comment 2 EFL EWS Bot 2013-07-01 08:53:59 PDT
Comment on attachment 205814 [details]
Patch

Attachment 205814 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/1015137
Comment 3 EFL EWS Bot 2013-07-01 08:57:01 PDT
Comment on attachment 205814 [details]
Patch

Attachment 205814 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/1001512
Comment 4 Brian Holt 2013-07-01 08:59:46 PDT
Created attachment 205815 [details]
Patch
Comment 5 EFL EWS Bot 2013-07-01 09:02:33 PDT
Comment on attachment 205815 [details]
Patch

Attachment 205815 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/1017025
Comment 6 EFL EWS Bot 2013-07-01 09:04:05 PDT
Comment on attachment 205815 [details]
Patch

Attachment 205815 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/919841
Comment 7 kov's GTK+ EWS bot 2013-07-01 09:04:49 PDT
Comment on attachment 205815 [details]
Patch

Attachment 205815 [details] did not pass gtk-ews (gtk):
Output: http://webkit-queues.appspot.com/results/887652
Comment 8 Brian Holt 2013-07-01 09:25:09 PDT
Created attachment 205817 [details]
Patch
Comment 9 Chris Dumez 2013-07-01 09:35:15 PDT
Comment on attachment 205817 [details]
Patch

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

> Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp:97
> +            GOwnPtr<char> objectText(textForRenderer(object));

This could be moved to the if() scope to avoid uselessly calling textForRenderer() when the condition is false.
Comment 10 Chris Dumez 2013-07-01 09:45:13 PDT
Comment on attachment 205817 [details]
Patch

Looks good. r=me but please fix the nit before landing.
Comment 11 Brian Holt 2013-07-01 10:10:29 PDT
Created attachment 205818 [details]
Final patch

Requesting CQ because I'm not a committer yet
Comment 12 Chris Dumez 2013-07-01 10:13:38 PDT
Comment on attachment 205818 [details]
Final patch

No need to set r? as this was already reviewed.
Comment 13 WebKit Commit Bot 2013-07-01 11:05:15 PDT
Comment on attachment 205818 [details]
Final patch

Clearing flags on attachment: 205818

Committed r152232: <http://trac.webkit.org/changeset/152232>
Comment 14 WebKit Commit Bot 2013-07-01 11:05:20 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Brian Holt 2013-07-02 01:26:12 PDT
Thanks very much Christophe!