[Webkit-unassigned] [Bug 118505] Leak: TextCodecICU::registerCodecs is leaking

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 9 09:56:15 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=118505





--- Comment #4 from Alexey Proskuryakov <ap at webkit.org>  2013-07-09 09:58:15 PST ---
> If we need our own copy of the string, should we also make a copy of canonicalConverterName on line 193?

Indeed!

> And if we're making copies then should the responsibility fall to TextCodecMap to free the additional data? But the additionalData is const implying (at least to me) that the TextCodecMap doesn't own that data.  

Generally speaking, constness is separate from ownership, it's perfectly fine to free a const pointer.

The tricky part here is that additional data is not necessarily a string pointer - TextCodecMap passes a pointer to a number. So the function to delete additional data needs to be provided by caller.

> What would you suggest would be the best way to address the leak?

I think that we shouldn't enumerate ICU aliases at all, and have our own encoding name table that's suitable for the web instead (similarly to what TextCodecMac does for legacy Mac encodings). That would be a valuable architectural improvement, and it would sidestep this issue entirely.

Given the complexity of fixing only this leak, we should consider just implementing the above idea.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list