From f598f92fe48f84b4e422a6a9e5a5cc4cb6313102 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@digia.com>
Date: Mon, 19 Aug 2013 12:57:44 +0200
Subject: [PATCH 1/8] [Qt] memory leak in
 WebCore::FontCache::getLastResortFallbackFont

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

Reviewed by Jocelyn Turcotte.

We don't need to allocate FontPlatformData on the heap
since getCachedFontData makes a deep copy anyway.

* platform/graphics/qt/FontCacheQt.cpp:
(WebCore::FontCache::getLastResortFallbackFont):

Change-Id: I02e974e53f36dd01a4b43a21cc98651913c0d515
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154103 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
---
 Source/WebCore/platform/graphics/qt/FontCacheQt.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp b/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp
index 6d1ee72..55a0f82 100644
--- a/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp
@@ -81,7 +81,8 @@ PassRefPtr<SimpleFontData> FontCache::getSimilarFontPlatformData(const Font& fon
 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     const AtomicString fallbackFamily = QFont(fontDescription.family().family()).lastResortFamily();
-    return getCachedFontData(new FontPlatformData(fontDescription, fallbackFamily), shouldRetain);
+    FontPlatformData platformData(fontDescription, fallbackFamily);
+    return getCachedFontData(&platformData, shouldRetain);
 }
 
 void FontCache::getTraitsInFamily(const AtomicString&, Vector<unsigned>&)
-- 
1.9.0

