Use Heap functions instead of malloc/free.

This commit is contained in:
Mike McCormack 2004-08-30 18:40:47 +00:00 committed by Alexandre Julliard
parent 55defb652a
commit 9386cb2228
1 changed files with 5 additions and 5 deletions

View File

@ -490,11 +490,11 @@ INT16 WINAPI OpenComm16(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
COM[port].obuf_size = cbOutQueue;
COM[port].obuf_head = COM[port].obuf_tail = 0;
COM[port].inbuf = malloc(cbInQueue);
COM[port].inbuf = HeapAlloc(GetProcessHeap(), 0, cbInQueue);
if (COM[port].inbuf) {
COM[port].outbuf = malloc(cbOutQueue);
COM[port].outbuf = HeapAlloc( GetProcessHeap(), 0, cbOutQueue);
if (!COM[port].outbuf)
free(COM[port].inbuf);
HeapFree( GetProcessHeap(), 0, COM[port].inbuf);
} else COM[port].outbuf = NULL;
if (!COM[port].outbuf) {
/* not enough memory */
@ -551,8 +551,8 @@ INT16 WINAPI CloseComm16(INT16 cid)
CancelIo(ptr->handle);
/* free buffers */
free(ptr->outbuf);
free(ptr->inbuf);
HeapFree( GetProcessHeap(), 0, ptr->outbuf);
HeapFree( GetProcessHeap(), 0, ptr->inbuf);
/* reset modem lines */
SetCommState16(&COM[cid].dcb);