Andrew Talbot : wineps.drv: Fix some memory leaks.

Alexandre Julliard julliard at winehq.org
Wed Oct 10 15:27:24 CDT 2007


Module: wine
Branch: master
Commit: a76d10d1d9499fc9ed1184c980ba88db182c3342
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a76d10d1d9499fc9ed1184c980ba88db182c3342

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Wed Oct 10 19:57:29 2007 +0100

wineps.drv: Fix some memory leaks.

---

 dlls/wineps.drv/init.c   |    1 +
 dlls/wineps.drv/type42.c |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index 0d1ddd1..0c4f539 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -629,6 +629,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
             value_name=NULL;
         }
         if (value_name) {
+            HeapFree(PSDRV_Heap, 0, ppdFileName);
             ppdFileName=HeapAlloc(PSDRV_Heap, 0, needed);
             RegQueryValueExA(hkey, value_name, 0, &ppdType, (LPBYTE)ppdFileName, &needed);
         }
diff --git a/dlls/wineps.drv/type42.c b/dlls/wineps.drv/type42.c
index 454d9b3..6031366 100644
--- a/dlls/wineps.drv/type42.c
+++ b/dlls/wineps.drv/type42.c
@@ -314,9 +314,6 @@ BOOL T42_download_glyph(PSDRV_PDEVICE *physDev, DOWNLOAD *pdl, DWORD index,
 				      t42->glyph_sent_size * sizeof(*(t42->glyph_sent)));
     }
 
-    buf = HeapAlloc(GetProcessHeap(), 0, sizeof(glyph_def) +
-		    strlen(pdl->ps_name) + 100);
-
     if(!get_glyf_pos(t42, index, &start, &end)) return FALSE;
     TRACE("start = %x end = %x\n", start, end);
 
@@ -352,6 +349,10 @@ BOOL T42_download_glyph(PSDRV_PDEVICE *physDev, DOWNLOAD *pdl, DWORD index,
 
     for(i = 1; t42->glyf_blocks[i]; i++)
         if(start < t42->glyf_blocks[i]) break;
+
+    buf = HeapAlloc(GetProcessHeap(), 0, sizeof(glyph_def) +
+		    strlen(pdl->ps_name) + 100);
+
     /* we don't have a string for the gdir and glyf tables, but we do have a 
        string for the TT header.  So the offset we need is tables - 2 */
     sprintf(buf, "%d %d\n", t42->num_of_written_tables - 2 + i, start - t42->glyf_blocks[i-1]);




More information about the wine-cvs mailing list