itss: Replace malloc() with HeapAlloc().
This commit is contained in:
parent
c83039bd6e
commit
193b9b8914
|
@ -36,15 +36,17 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "lzx.h"
|
#include "lzx.h"
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
|
||||||
/* sized types */
|
/* sized types */
|
||||||
typedef unsigned char UBYTE; /* 8 bits exactly */
|
typedef unsigned char UBYTE; /* 8 bits exactly */
|
||||||
typedef unsigned short UWORD; /* 16 bits (or more) */
|
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 */
|
/* some constants defined by the LZX specification */
|
||||||
#define LZX_MIN_MATCH (2)
|
#define LZX_MIN_MATCH (2)
|
||||||
|
@ -178,10 +180,10 @@ struct LZXstate *LZXinit(int window)
|
||||||
if (window < 15 || window > 21) return NULL;
|
if (window < 15 || window > 21) return NULL;
|
||||||
|
|
||||||
/* allocate state and associated window */
|
/* allocate state and associated window */
|
||||||
pState = malloc(sizeof(struct LZXstate));
|
pState = HeapAlloc(GetProcessHeap(), 0, sizeof(struct LZXstate));
|
||||||
if (!(pState->window = malloc(wndsize)))
|
if (!(pState->window = HeapAlloc(GetProcessHeap(), 0, wndsize)))
|
||||||
{
|
{
|
||||||
free(pState);
|
HeapFree(GetProcessHeap(), 0, pState);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pState->actual_size = wndsize;
|
pState->actual_size = wndsize;
|
||||||
|
@ -217,8 +219,8 @@ void LZXteardown(struct LZXstate *pState)
|
||||||
{
|
{
|
||||||
if (pState)
|
if (pState)
|
||||||
{
|
{
|
||||||
free(pState->window);
|
HeapFree(GetProcessHeap(), 0, pState->window);
|
||||||
free(pState);
|
HeapFree(GetProcessHeap(), 0, pState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue