Commit 044e76df authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

winedos: Replace malloc/calloc with HeapAlloc().

parent b5d1bfe5
...@@ -134,7 +134,7 @@ static void do_strategy(CONTEXT86*ctx, int id, int extra) ...@@ -134,7 +134,7 @@ static void do_strategy(CONTEXT86*ctx, int id, int extra)
void **hdr_ptr = strategy_data[id]; void **hdr_ptr = strategy_data[id];
if (!hdr_ptr) { if (!hdr_ptr) {
hdr_ptr = calloc(1,sizeof(void *)+extra); hdr_ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(void *)+extra);
strategy_data[id] = hdr_ptr; strategy_data[id] = hdr_ptr;
} }
*hdr_ptr = hdr; *hdr_ptr = hdr;
......
...@@ -264,7 +264,7 @@ static int DOSCONF_Country(char **confline) ...@@ -264,7 +264,7 @@ static int DOSCONF_Country(char **confline)
if (!(DOSCONF_JumpToEntry(confline, '='))) return 0; if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
TRACE( "Country '%s'\n", *confline ); TRACE( "Country '%s'\n", *confline );
if (DOSCONF_config.country == NULL) if (DOSCONF_config.country == NULL)
DOSCONF_config.country = malloc(strlen(*confline) + 1); DOSCONF_config.country = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(DOSCONF_config.country, *confline); strcpy(DOSCONF_config.country, *confline);
return 1; return 1;
} }
...@@ -304,7 +304,7 @@ static int DOSCONF_Shell(char **confline) ...@@ -304,7 +304,7 @@ static int DOSCONF_Shell(char **confline)
if (!(DOSCONF_JumpToEntry(confline, '='))) return 0; if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
TRACE( "Shell '%s'\n", *confline ); TRACE( "Shell '%s'\n", *confline );
if (DOSCONF_config.shell == NULL) if (DOSCONF_config.shell == NULL)
DOSCONF_config.shell = malloc(strlen(*confline) + 1); DOSCONF_config.shell = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(DOSCONF_config.shell, *confline); strcpy(DOSCONF_config.shell, *confline);
return 1; return 1;
} }
...@@ -354,7 +354,7 @@ static int DOSCONF_Menu(char **confline) ...@@ -354,7 +354,7 @@ static int DOSCONF_Menu(char **confline)
&& (!(strncasecmp(*confline, DOSCONF_menu_default, && (!(strncasecmp(*confline, DOSCONF_menu_default,
strlen(DOSCONF_menu_default))))) strlen(DOSCONF_menu_default)))))
{ {
free(DOSCONF_menu_default); HeapFree(GetProcessHeap(), 0, DOSCONF_menu_default);
DOSCONF_menu_default = NULL; DOSCONF_menu_default = NULL;
DOSCONF_menu_skip = 0; DOSCONF_menu_skip = 0;
} }
...@@ -367,7 +367,7 @@ static int DOSCONF_Menu(char **confline) ...@@ -367,7 +367,7 @@ static int DOSCONF_Menu(char **confline)
{ {
if (!(DOSCONF_JumpToEntry(confline, '='))) return 0; if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
*confline = strtok(*confline, ","); *confline = strtok(*confline, ",");
DOSCONF_menu_default = malloc(strlen(*confline) + 1); DOSCONF_menu_default = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(DOSCONF_menu_default, *confline); strcpy(DOSCONF_menu_default, *confline);
} }
...@@ -384,10 +384,10 @@ static int DOSCONF_Include(char **confline) ...@@ -384,10 +384,10 @@ static int DOSCONF_Include(char **confline)
fgetpos(DOSCONF_fd, &oldpos); fgetpos(DOSCONF_fd, &oldpos);
fseek(DOSCONF_fd, 0, SEEK_SET); fseek(DOSCONF_fd, 0, SEEK_SET);
TRACE( "Including menu '%s'\n", *confline ); TRACE( "Including menu '%s'\n", *confline );
temp = malloc(strlen(*confline) + 1); temp = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(temp, *confline); strcpy(temp, *confline);
DOSCONF_Parse(temp); DOSCONF_Parse(temp);
free(temp); HeapFree(GetProcessHeap(), 0, temp);
fsetpos(DOSCONF_fd, &oldpos); fsetpos(DOSCONF_fd, &oldpos);
return 1; return 1;
} }
......
...@@ -182,7 +182,7 @@ static void DOSVM_SendOneEvent( CONTEXT86 *context ) ...@@ -182,7 +182,7 @@ static void DOSVM_SendOneEvent( CONTEXT86 *context )
DOSVM_BuildCallFrame( context, event->relay, event->data ); DOSVM_BuildCallFrame( context, event->relay, event->data );
} }
free(event); HeapFree(GetProcessHeap(), 0, event);
} }
} }
...@@ -257,7 +257,7 @@ void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVOID data ...@@ -257,7 +257,7 @@ void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVOID data
BOOL old_pending; BOOL old_pending;
if (MZ_Current()) { if (MZ_Current()) {
event = malloc(sizeof(DOSEVENT)); event = HeapAlloc(GetProcessHeap(), 0, sizeof(DOSEVENT));
if (!event) { if (!event) {
ERR("out of memory allocating event entry\n"); ERR("out of memory allocating event entry\n");
return; return;
...@@ -622,7 +622,7 @@ void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val) ...@@ -622,7 +622,7 @@ void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val)
current_event = event->next; current_event = event->next;
if (event->relay) if (event->relay)
(*event->relay)(NULL,event->data); (*event->relay)(NULL,event->data);
free(event); HeapFree(GetProcessHeap(), 0, event);
if (DOSVM_HasPendingEvents()) if (DOSVM_HasPendingEvents())
{ {
......
...@@ -218,7 +218,7 @@ static void MouseRelay(CONTEXT86 *context,void *mdata) ...@@ -218,7 +218,7 @@ static void MouseRelay(CONTEXT86 *context,void *mdata)
ctx.Edi = data->my; ctx.Edi = data->my;
ctx.SegCs = SELECTOROF(data->proc); ctx.SegCs = SELECTOROF(data->proc);
ctx.Eip = OFFSETOF(data->proc); ctx.Eip = OFFSETOF(data->proc);
free(data); HeapFree(GetProcessHeap(), 0, data);
DPMI_CallRMProc(&ctx, NULL, 0, 0); DPMI_CallRMProc(&ctx, NULL, 0, 0);
} }
...@@ -264,7 +264,7 @@ static void QueueMouseRelay(DWORD mx, DWORD my, WORD mask) ...@@ -264,7 +264,7 @@ static void QueueMouseRelay(DWORD mx, DWORD my, WORD mask)
} }
if ((mask & mouse_info.callmask) && mouse_info.callback) { if ((mask & mouse_info.callmask) && mouse_info.callback) {
MCALLDATA *data = calloc(1,sizeof(MCALLDATA)); MCALLDATA *data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MCALLDATA));
data->proc = mouse_info.callback; data->proc = mouse_info.callback;
data->mask = mask & mouse_info.callmask; data->mask = mask & mouse_info.callmask;
data->but = mouse_info.but; data->but = mouse_info.but;
......
...@@ -181,7 +181,7 @@ char IO_pp_init(void) ...@@ -181,7 +181,7 @@ char IO_pp_init(void)
ERR("Perhaps the device is already in use or nonexistent\n"); ERR("Perhaps the device is already in use or nonexistent\n");
continue; continue;
} }
PPDeviceList[nports].devicename = malloc(sizeof(buffer)+1); PPDeviceList[nports].devicename = HeapAlloc(GetProcessHeap(), 0, sizeof(buffer)+1);
if (!PPDeviceList[nports].devicename) if (!PPDeviceList[nports].devicename)
{ {
ERR("No (more) space for devicename\n"); ERR("No (more) space for devicename\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment