Use Heap functions instead of malloc/free.
This commit is contained in:
parent
55defb652a
commit
9386cb2228
|
@ -490,11 +490,11 @@ INT16 WINAPI OpenComm16(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
|
||||||
COM[port].obuf_size = cbOutQueue;
|
COM[port].obuf_size = cbOutQueue;
|
||||||
COM[port].obuf_head = COM[port].obuf_tail = 0;
|
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) {
|
if (COM[port].inbuf) {
|
||||||
COM[port].outbuf = malloc(cbOutQueue);
|
COM[port].outbuf = HeapAlloc( GetProcessHeap(), 0, cbOutQueue);
|
||||||
if (!COM[port].outbuf)
|
if (!COM[port].outbuf)
|
||||||
free(COM[port].inbuf);
|
HeapFree( GetProcessHeap(), 0, COM[port].inbuf);
|
||||||
} else COM[port].outbuf = NULL;
|
} else COM[port].outbuf = NULL;
|
||||||
if (!COM[port].outbuf) {
|
if (!COM[port].outbuf) {
|
||||||
/* not enough memory */
|
/* not enough memory */
|
||||||
|
@ -551,8 +551,8 @@ INT16 WINAPI CloseComm16(INT16 cid)
|
||||||
CancelIo(ptr->handle);
|
CancelIo(ptr->handle);
|
||||||
|
|
||||||
/* free buffers */
|
/* free buffers */
|
||||||
free(ptr->outbuf);
|
HeapFree( GetProcessHeap(), 0, ptr->outbuf);
|
||||||
free(ptr->inbuf);
|
HeapFree( GetProcessHeap(), 0, ptr->inbuf);
|
||||||
|
|
||||||
/* reset modem lines */
|
/* reset modem lines */
|
||||||
SetCommState16(&COM[cid].dcb);
|
SetCommState16(&COM[cid].dcb);
|
||||||
|
|
Loading…
Reference in New Issue