Andrew Talbot : itss: Replace malloc() with HeapAlloc().

Alexandre Julliard julliard at winehq.org
Wed Feb 11 09:24:50 CST 2009


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

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Tue Feb 10 22:18:08 2009 +0000

itss: Replace malloc() with HeapAlloc().

---

 dlls/itss/lzx.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/dlls/itss/lzx.c b/dlls/itss/lzx.c
index b5fdfc7..01a9492 100644
--- a/dlls/itss/lzx.c
+++ b/dlls/itss/lzx.c
@@ -36,15 +36,17 @@
  ***************************************************************************/
 
 #include "lzx.h"
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "windef.h"
+#include "winbase.h"
+
 /* sized types */
 typedef unsigned char  UBYTE; /* 8 bits exactly    */
 typedef unsigned short UWORD; /* 16 bits (or more) */
-typedef unsigned int   ULONG; /* 32 bits (or more) */
-typedef   signed int    LONG; /* 32 bits (or more) */
 
 /* some constants defined by the LZX specification */
 #define LZX_MIN_MATCH                (2)
@@ -178,10 +180,10 @@ struct LZXstate *LZXinit(int window)
     if (window < 15 || window > 21) return NULL;
 
     /* allocate state and associated window */
-    pState = malloc(sizeof(struct LZXstate));
-    if (!(pState->window = malloc(wndsize)))
+    pState = HeapAlloc(GetProcessHeap(), 0, sizeof(struct LZXstate));
+    if (!(pState->window = HeapAlloc(GetProcessHeap(), 0, wndsize)))
     {
-        free(pState);
+        HeapFree(GetProcessHeap(), 0, pState);
         return NULL;
     }
     pState->actual_size = wndsize;
@@ -217,8 +219,8 @@ void LZXteardown(struct LZXstate *pState)
 {
     if (pState)
     {
-        free(pState->window);
-        free(pState);
+        HeapFree(GetProcessHeap(), 0, pState->window);
+        HeapFree(GetProcessHeap(), 0, pState);
     }
 }
 




More information about the wine-cvs mailing list