Bug 37500 - [Gtk] Fix leaking the FontPlatformData instance used to create the the small caps font data.
Summary: [Gtk] Fix leaking the FontPlatformData instance used to create the the small ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-13 07:01 PDT by Stephan Aßmus
Modified: 2010-05-03 09:57 PDT (History)
2 users (show)

See Also:


Attachments
Patch to fix the problem (1.67 KB, patch)
2010-04-13 07:04 PDT, Stephan Aßmus
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Aßmus 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.
Comment 1 Stephan Aßmus 2010-04-13 07:04:01 PDT
Created attachment 53243 [details]
Patch to fix the problem
Comment 2 Holger Freyther 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!
Comment 3 Holger Freyther 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.
Comment 4 WebKit Commit Bot 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>
Comment 5 WebKit Commit Bot 2010-05-03 09:57:06 PDT
All reviewed patches have been landed.  Closing bug.