<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>141614</bug_id>
          
          <creation_ts>2015-02-14 19:14:06 -0800</creation_ts>
          <short_desc>[iOS] Possible Block Leak WKAutoCorrectionData.autocorrectionContextHandler</short_desc>
          <delta_ts>2015-02-14 19:14:06 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>enrica</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1069254</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-02-14 19:14:06 -0800</bug_when>
    <thetext>* SUMMARY
Possible Block Leak WKAutoCorrectionData.autocorrectionContextHandler.

Auditing the code, it looks like this block can be assigned a copy that is never released by anyone:

        _autocorrectionData.autocorrectionContextHandler = [completionHandler copy];
        _page-&gt;requestAutocorrectionContext([self](...) {
            _autocorrectionData.autocorrectionContextHandler([WKAutocorrectionContext autocorrectionContextWithData:beforeText markedText:markedText selectedText:selectedText afterText:afterText selectedRangeInMarkedText:NSMakeRange(location, length)]);
        });

Looks like we should be releasing (and probably niling) _autocorrectionData.autocorrectionContextHandler. Or better yet, don&apos;t store these on the struct at all, and just capture them inside the block/lambda.

All of the blocks assigned to WKAutoCorrectionData have sketchy lifetimes. They can are always set on the struct without clearing any possible value that may have been there before. Is there a guarantee that they won&apos;t be overwritten?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>