Bug 141614

Summary: [iOS] Possible Block Leak WKAutoCorrectionData.autocorrectionContextHandler
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: enrica, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Joseph Pecoraro
Reported 2015-02-14 19:14:06 PST
* 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->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'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't be overwritten?
Attachments
Note You need to log in before you can comment on or make changes to this bug.