itss: Replace malloc() with HeapAlloc()

Nikolay Sivov bunglehead at gmail.com
Mon Feb 9 16:57:09 CST 2009


Andrew Talbot wrote:
> Changelog:
>     itss: Replace malloc() with HeapAlloc().
>
> diff --git a/dlls/itss/lzx.c b/dlls/itss/lzx.c
> index b5fdfc7..0ffeeb6 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,8 +180,8 @@ 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);
>          return NULL;
>   
Why didn't you replace corresponding free() calls?




More information about the wine-devel mailing list