Bug 17199

Summary: ElementRareDataMap should use OwnPtr to avoid any possible leaks
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: andersca, aroben, mjs
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Macintosh   
OS: OS X 10.5   

Description Eric Seidel (no email) 2008-02-06 13:34:58 PST
ElementRareDataMap should use OwnPtr to avoid any possible leaks

Assuming this is safe,
typedef HashMap<const Element*, ElementRareData*> ElementRareDataMap;

Should be changed to:
typedef HashMap<const Element*, OwnPtr<ElementRareData>> ElementRareDataMap;

To avoid any possible leaks.  Holding new'd objects in raw pointers is dangerous.
Comment 1 Adam Roben (:aroben) 2008-02-06 13:42:58 PST
(In reply to comment #0)
> ElementRareDataMap should use OwnPtr to avoid any possible leaks
> 
> Assuming this is safe,
> typedef HashMap<const Element*, ElementRareData*> ElementRareDataMap;
> 
> Should be changed to:
> typedef HashMap<const Element*, OwnPtr<ElementRareData>> ElementRareDataMap;

I'm not sure this is possible, since OwnPtr isn't copyable.
Comment 2 Eric Seidel (no email) 2008-02-06 14:07:38 PST
Yeah, I tried.  OwnPtr isn't copyable, thus this didn't work.  There has to be a solution here though.  Maybe auto_ptr?  There should be construct we can use to do this safely, and make it *very obvious* when reading the code that the memory management is correct.
Comment 3 Anders Carlsson 2014-01-13 21:56:59 PST
We no longer store rare data in a side table.