Bug 118362

Summary: [ATK] Leak: more leaks in AccessibilityUIElement
Product: WebKit Reporter: Brian Holt <brian.holt>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eflews.bot, gtk-ews, gyuyoung.kim, 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

Description Brian Holt 2013-07-03 10:15:26 PDT
In Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:

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

{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   fun:malloc
   fun:__vasprintf_chk
   fun:g_vasprintf
   fun:g_strdup_vprintf
   fun:g_strdup_printf
   fun:_ZN22AccessibilityUIElement8languageEv
   fun:_ZL19getLanguageCallbackPK15OpaqueJSContextP13OpaqueJSValueP14OpaqueJSStringPPKS2_
   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
   fun:_ZN7WebCore18HTMLDocumentParser13pumpTokenizerENS0_15SynchronousModeE
}

{
   <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:_ZN7WebCore16ScriptController8evaluateERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13executeScriptERKNS_16ScriptSourceCodeE
   fun:_ZN7WebCore13ScriptElement13prepareScriptERKN3WTF12TextPositionENS0_17LegacyTypeSupportE
   fun:_ZN7WebCore16HTMLScriptRunner9runScriptEPNS_7ElementERKN3WTF12TextPositionE
}
Comment 1 Brian Holt 2013-07-03 10:51:08 PDT
Created attachment 206012 [details]
Patch
Comment 2 EFL EWS Bot 2013-07-03 10:54:35 PDT
Comment on attachment 206012 [details]
Patch

Attachment 206012 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/1015764
Comment 3 Brian Holt 2013-07-03 10:55:11 PDT
The title one is a bit trickier because 

   fun:g_strdup
   fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii
   fun:_ZL23webkitAccessibleGetNameP10_AtkObject
   fun:_ZN22AccessibilityUIElement5titleEv

webkitAccessibleGetName(AtkObject*) sometimes returns a char* that is created by g_strdup but it also sometimes returns a value stored in a cache.  Freeing that would be a disaster.  

My feeling at this stage is that the effort required to refactor is not worth the few bytes leaking.
Comment 4 EFL EWS Bot 2013-07-03 10:56:47 PDT
Comment on attachment 206012 [details]
Patch

Attachment 206012 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/1012992
Comment 5 kov's GTK+ EWS bot 2013-07-03 10:57:32 PDT
Comment on attachment 206012 [details]
Patch

Attachment 206012 [details] did not pass gtk-ews (gtk):
Output: http://webkit-queues.appspot.com/results/1022262
Comment 6 Chris Dumez 2013-07-03 10:59:14 PDT
Comment on attachment 206012 [details]
Patch

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

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:439
> +    GOwnPtr<char> axValue(g_strdup_printf("AXLanguage: %s", locale))

missing ;

> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:625
> +    GOwnPtr<char> axValue(g_strdup_printf("AXLanguage: %s", locale))

ditto.
Comment 7 Brian Holt 2013-07-03 11:03:45 PDT
Created attachment 206013 [details]
Patch
Comment 8 Chris Dumez 2013-07-03 11:06:15 PDT
Comment on attachment 206013 [details]
Patch

Ok, r=me. Do you want me to commit? You did not set the cq flag.
Comment 9 Brian Holt 2013-07-03 11:08:01 PDT
(In reply to comment #8)
> (From update of attachment 206013 [details])
> Ok, r=me. Do you want me to commit? You did not set the cq flag.

Yes please, I forgot to do that with webkit-patch.
Comment 10 WebKit Commit Bot 2013-07-03 11:51:08 PDT
Comment on attachment 206013 [details]
Patch

Clearing flags on attachment: 206013

Committed r152371: <http://trac.webkit.org/changeset/152371>
Comment 11 WebKit Commit Bot 2013-07-03 11:51:10 PDT
All reviewed patches have been landed.  Closing bug.