Bug 77114

Summary: IndexedDB: WebCore::IDBKey objects are leaked
Product: WebKit Reporter: Joshua Bell <jsbell>
Component: New BugsAssignee: Joshua Bell <jsbell>
Status: RESOLVED FIXED    
Severity: Normal CC: dgrogan, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Joshua Bell 2012-01-26 10:15:49 PST
IndexedDB: WebCore::IDBKey objects are leaked
Comment 1 Joshua Bell 2012-01-26 10:16:31 PST
Created attachment 124135 [details]
Patch
Comment 2 Joshua Bell 2012-01-26 10:17:42 PST
Tossing the patch up to let the bots have at it. On the one hand this looks like a no-brainer. On the other hand, it can't be this easy, can it?
Comment 3 David Grogan 2012-01-26 10:38:44 PST
Comment on attachment 124135 [details]
Patch

Looks promising.  You'll have to get rid of the No new tests. (OOPS!) line.
Comment 4 David Grogan 2012-01-26 10:42:52 PST
Comment on attachment 124135 [details]
Patch

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

> Source/WebCore/storage/IDBKey.h:69
> +        RefPtr<IDBKey> idbKey = adoptRef(new IDBKey());

Though, could you change these to use the common IDBKey::create() pattern?
Comment 5 Joshua Bell 2012-01-26 10:48:24 PST
(In reply to comment #4)
> (From update of attachment 124135 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=124135&action=review
> 
> > Source/WebCore/storage/IDBKey.h:69
> > +        RefPtr<IDBKey> idbKey = adoptRef(new IDBKey());
> 
> Though, could you change these to use the common IDBKey::create() pattern?

Do you mean, change these (where possible) to IDBKey::create(<Type>) with various type overloads, or adding a private static IDBKey::create() that the current createXXX() methods are changed to call?
Comment 6 David Grogan 2012-01-26 10:54:36 PST
Comment on attachment 124135 [details]
Patch

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

>>> Source/WebCore/storage/IDBKey.h:69
>>> +        RefPtr<IDBKey> idbKey = adoptRef(new IDBKey());
>> 
>> Though, could you change these to use the common IDBKey::create() pattern?
> 
> Do you mean, change these (where possible) to IDBKey::create(<Type>) with various type overloads, or adding a private static IDBKey::create() that the current createXXX() methods are changed to call?

I had meant the second, but I hadn't noticed that these were already createXXX methods.  So an IDBKey::create() probably doesn't add much.  Request retracted.
Comment 7 Joshua Bell 2012-01-26 11:04:48 PST
Created attachment 124149 [details]
Patch
Comment 8 Joshua Bell 2012-01-26 11:07:52 PST
tony@ - can you r? 

Again, this seems simple enough that I feel like I'm missing something.
Comment 9 Tony Chang 2012-01-26 11:12:24 PST
Comment on attachment 124149 [details]
Patch

This looks correct.  There are other examples of this pattern in the code (e.g., SecurityOrigin::create).
Comment 10 Joshua Bell 2012-01-26 11:15:55 PST
I'll verify this with valgrind if possible before landing it.
Comment 11 Joshua Bell 2012-01-26 15:29:41 PST
Running under valgrind:

sh tools/valgrind/chrome_tests.sh -t ui --gtest_filter='IndexedDBUILayoutTest.LayoutTests'

* Without this patch it reports 11 suppressions of bug_109463 http://crbug.com/109463
* With this patch it reports 0 suppressions of bug_109463

I'm calling that good.
Comment 12 WebKit Review Bot 2012-01-26 16:07:27 PST
Comment on attachment 124149 [details]
Patch

Clearing flags on attachment: 124149

Committed r106059: <http://trac.webkit.org/changeset/106059>
Comment 13 WebKit Review Bot 2012-01-26 16:07:31 PST
All reviewed patches have been landed.  Closing bug.