wineps.drv: fix memory leak

Pierre Schweitzer pierre at reactos.org
Tue Dec 6 16:34:44 CST 2011


-------------- next part --------------
>From bb0aff9e46f3c0469034d79f1a41e3e50fcc5401 Mon Sep 17 00:00:00 2001
From: Pierre Schweitzer <pierre at reactos.org>
Date: Tue, 6 Dec 2011 21:54:42 +0100
Subject: Fix memory leak

---
 dlls/wineps.drv/download.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/wineps.drv/download.c b/dlls/wineps.drv/download.c
index 6996205..49a993f 100644
--- a/dlls/wineps.drv/download.c
+++ b/dlls/wineps.drv/download.c
@@ -259,13 +259,19 @@ BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev)
     assert(physDev->font.fontloc == Download);
 
     potm = HeapAlloc(GetProcessHeap(), 0, len);
+    if (!potm)
+        return FALSE;
+
     GetOutlineTextMetricsA(dev->hdc, len, potm);
 
     get_download_name(dev, potm, &ps_name);
     physDev->font.fontinfo.Download = is_font_downloaded(physDev, ps_name);
 
     if (!GetObjectW( GetCurrentObject(dev->hdc, OBJ_FONT), sizeof(lf), &lf ))
+    {
+        HeapFree(GetProcessHeap(), 0, potm);
         return FALSE;
+    }
 
     ppem = calc_ppem_for_height(dev->hdc, lf.lfHeight);
 
-- 
1.7.4.1



More information about the wine-patches mailing list