Bug 134038

Summary: -[JSContext setName:] leaks NSString
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: JavaScriptCoreAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ggaren, joepeck, mhahnenberg, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch v1 none

David Kilzer (:ddkilzer)
Reported 2014-06-18 13:51:55 PDT
JavaScriptCore/API/JSContext.mm:200:73: warning: Potential leak of an object JSStringRef nameJS = name ? JSStringCreateWithCFString((CFStringRef)[name copy]) : nullptr; ^
Attachments
Patch v1 (1.66 KB, patch)
2014-06-18 13:53 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2014-06-18 13:53:28 PDT
Created attachment 233325 [details] Patch v1
Joseph Pecoraro
Comment 2 2014-06-18 14:05:29 PDT
Comment on attachment 233325 [details] Patch v1 r=me! Thanks
WebKit Commit Bot
Comment 3 2014-06-18 14:42:13 PDT
Comment on attachment 233325 [details] Patch v1 Clearing flags on attachment: 233325 Committed r170117: <http://trac.webkit.org/changeset/170117>
WebKit Commit Bot
Comment 4 2014-06-18 14:42:15 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 5 2014-06-19 20:39:18 PDT
Comment on attachment 233325 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=233325&action=review > Source/JavaScriptCore/API/JSContext.mm:200 > - JSStringRef nameJS = name ? JSStringCreateWithCFString((CFStringRef)[name copy]) : nullptr; > + JSStringRef nameJS = name ? JSStringCreateWithCFString((CFStringRef)[[name copy] autorelease]) : nullptr; Why not just remove the call to copy? There’s no need for a copy here.
Note You need to log in before you can comment on or make changes to this bug.