RESOLVED FIXED 37500
[Gtk] Fix leaking the FontPlatformData instance used to create the the small caps font data.
https://bugs.webkit.org/show_bug.cgi?id=37500
Summary [Gtk] Fix leaking the FontPlatformData instance used to create the the small ...
Stephan Aßmus
Reported 2010-04-13 07:01:44 PDT
WebCore::SimpleFontData::smallCapsFontData() is allocating a FontPlatformData object on the heap and assigns it to a const pointer and never frees it. The FontPlatformData is used for assigning the member of the same type in a SimpleFontData object. Usually, ports implement the data of FontPlatformData to be reference counted, and the instance in SimpleFontData takes over the ownership (same in the Gtk port). The Haiku port contained the same problem initially, that's why I spotted it when cross referencing the Gtk port.
Attachments
Patch to fix the problem (1.67 KB, patch)
2010-04-13 07:04 PDT, Stephan Aßmus
no flags
Stephan Aßmus
Comment 1 2010-04-13 07:04:01 PDT
Created attachment 53243 [details] Patch to fix the problem
Holger Freyther
Comment 2 2010-05-03 07:49:04 PDT
Comment on attachment 53243 [details] Patch to fix the problem > Index: WebCore/ChangeLog > =================================================================== > --- WebCore/ChangeLog (revision 57513) > +++ WebCore/ChangeLog (working copy) > @@ -1,3 +1,18 @@ > +2010-04-13 Stephan AÃmus <superstippi@gmx.de> > + > + Reviewed by NOBODY (OOPS!). > + > + [Gtk] Fix leaking the FontPlatformData instance used to create the the > + small caps font data. > + https://bugs.webkit.org/show_bug.cgi?id=37500 > + > + No new tests needed. > + > + * platform/graphics/gtk/SimpleFontDataPango.cpp: > + (WebCore::SimpleFontData::smallCapsFontData): > + - Use a stack allocated FontPlatformData instead of a heap allocated > + one that is never freed. Thanks a lot!
Holger Freyther
Comment 3 2010-05-03 07:57:28 PDT
git grep "const FontPlatformData\* pdata = new" WebCore/platform/graphics/ WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp: const FontPlatfo WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp: const FontPlatform WebCore/platform/graphics/wx/SimpleFontDataWx.cpp: so, we need to fix these two as well.
WebKit Commit Bot
Comment 4 2010-05-03 09:57:02 PDT
Comment on attachment 53243 [details] Patch to fix the problem Clearing flags on attachment: 53243 Committed r58679: <http://trac.webkit.org/changeset/58679>
WebKit Commit Bot
Comment 5 2010-05-03 09:57:06 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.