Bug 58004 - Memory Leak in CoreIPC::decodeResourceError
Summary: Memory Leak in CoreIPC::decodeResourceError
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 18:35 PDT by Michael Saboff
Modified: 2011-04-07 09:08 PDT (History)
0 users

See Also:


Attachments
Patch to wrap NSError allocation with autorelease (1.45 KB, patch)
2011-04-06 18:41 PDT, Michael Saboff
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2011-04-06 18:35:50 PDT
The local NSError object created in decodeResourceError() has a retain count of 2 when the function exits.  One is needed for the ResourceError reference argument, the other should be released directly or via an autorelease.
Comment 1 Michael Saboff 2011-04-06 18:41:01 PDT
Created attachment 88555 [details]
Patch to wrap NSError allocation with autorelease
Comment 2 Maciej Stachowiak 2011-04-06 18:46:54 PDT
Comment on attachment 88555 [details]
Patch to wrap NSError allocation with autorelease

r=me

(But why autorelease instead of release? Explicit release is usually better.)
Comment 3 Darin Adler 2011-04-06 20:37:00 PDT
Comment on attachment 88555 [details]
Patch to wrap NSError allocation with autorelease

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

> Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm:188
> +    NSError *nsError = [[[NSError alloc] initWithDomain:nsString(domain) code:code userInfo:userInfo] autorelease];

A plain old release is much faster than autorelease, so it would be better to do it that way.
Comment 4 Michael Saboff 2011-04-07 09:08:11 PDT
Committed r83177: <http://trac.webkit.org/changeset/83177>