Alexandre Julliard : kernel32: Allocate global arenas on the Win32 heap.

Alexandre Julliard julliard at winehq.org
Fri Oct 31 09:23:58 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Oct 31 13:01:31 2008 +0100

kernel32: Allocate global arenas on the Win32 heap.

---

 dlls/kernel32/global16.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/global16.c b/dlls/kernel32/global16.c
index 2fdb5d8..6d70767 100644
--- a/dlls/kernel32/global16.c
+++ b/dlls/kernel32/global16.c
@@ -113,12 +113,15 @@ static GLOBALARENA *GLOBAL_GetArena( WORD sel, WORD selcount )
     if (((sel >> __AHSHIFT) + selcount) > globalArenaSize)
     {
         int newsize = ((sel >> __AHSHIFT) + selcount + 0xff) & ~0xff;
-        GLOBALARENA *pNewArena = realloc( pGlobalArena,
-                                          newsize * sizeof(GLOBALARENA) );
+        GLOBALARENA *pNewArena;
+
+        if (pGlobalArena)
+            pNewArena = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
+                                     pGlobalArena, newsize * sizeof(GLOBALARENA) );
+        else
+            pNewArena = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, newsize * sizeof(GLOBALARENA) );
         if (!pNewArena) return 0;
         pGlobalArena = pNewArena;
-        memset( pGlobalArena + globalArenaSize, 0,
-                (newsize - globalArenaSize) * sizeof(GLOBALARENA) );
         globalArenaSize = newsize;
     }
     return pGlobalArena + (sel >> __AHSHIFT);




More information about the wine-cvs mailing list