bugfix: wineps.drv: freeing of not allocated memory in type42.c

Wolfgang Walter wine at stwm.de
Mon Dec 15 03:57:13 CST 2008

T42_download_header calls T42_free if the truetype font is not

if(i < num_of_tables) {
	TRACE("Table %d has length %d.  Will use Type 1 font instead.\n", i, t42->tables[i].len);
	return NULL;

But *t42 is not completely initialised yet, escpecially the pointers


So T42_free may free memory not allocated. Often one gets something like

err:heap:HEAP_ValidateInUseArena Heap 0x110000: prev arena 0x2bc3110 is not prev for in-use 0x2bc3698

This patch simply allocates *t42 with flag HEAP_ZERO_MEMORY.
 dlls/wineps.drv/type42.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/wineps.drv/type42.c b/dlls/wineps.drv/type42.c
index 172072e..23f626c 100644
--- a/dlls/wineps.drv/type42.c
+++ b/dlls/wineps.drv/type42.c
@@ -166,7 +166,7 @@ TYPE42 *T42_download_header(PSDRV_PDEVICE *physDev, char *ps_name,
       "currentdict end dup /FontName get exch definefont pop\n";
-    t42 = HeapAlloc(GetProcessHeap(), 0, sizeof(*t42));
+    t42 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t42));
     memcpy(t42->tables, tables_templ, sizeof(tables_templ));
     t42->loca_tab = t42->glyf_tab = t42->head_tab = t42->hmtx_tab = -1;
     t42->emsize = emsize;

Wolfgang Walter
Studentenwerk München
Anstalt des öffentlichen Rechts
Leiter EDV
Leopoldstraße 15
80802 München

More information about the wine-patches mailing list