Bug 112832 - Objective-C API: Fix over-releasing in allocateConstructorAndPrototypeWithSuperClassInfo:
Summary: Objective-C API: Fix over-releasing in allocateConstructorAndPrototypeWithSup...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Hahnenberg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-20 13:25 PDT by Mark Hahnenberg
Modified: 2013-03-20 14:44 PDT (History)
0 users

See Also:


Attachments
Patch (3.52 KB, patch)
2013-03-20 13:49 PDT, Mark Hahnenberg
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hahnenberg 2013-03-20 13:25:51 PDT
If either the m_constructor or m_prototype (but not both) is collected, we will call allocateConstructorAndPrototypeWithSuperClassInfo, which will create a new object to replace the one that was collected, but at the end of the method we call release on both of them. This is incorrect since we autorelease the JSValue in the case that the object doesn't need to be reallocated. Thus we'll end up overreleasing later during the drain of the autorelease pool.
Comment 1 Mark Hahnenberg 2013-03-20 13:49:24 PDT
Created attachment 194111 [details]
Patch
Comment 2 Mark Hahnenberg 2013-03-20 13:53:12 PDT
<rdar://problem/13465627>
Comment 3 Geoffrey Garen 2013-03-20 13:57:53 PDT
Comment on attachment 194111 [details]
Patch

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

r=me

> Source/JavaScriptCore/ChangeLog:15
> +        (createObjectWithCustomBrand): We no longer alloc here. We instead call the JSValue valueWithValue class method,

"create" is a term of art for returning a +1 retained object. Since you're changing this function to return an autoreleased object, you should rename it to "objectWithCustomBrand".
Comment 4 Mark Hahnenberg 2013-03-20 14:44:17 PDT
Committed r146392: <http://trac.webkit.org/changeset/146392>