[PATCH 1/2] wbemprox: Use CRT allocation functions.
Hans Leidekker
hans at codeweavers.com
Mon Jan 31 07:49:43 CST 2022
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/wbemprox/builtin.c | 284 +++++++++++++++----------------
dlls/wbemprox/class.c | 52 +++---
dlls/wbemprox/qualifier.c | 22 +--
dlls/wbemprox/query.c | 50 +++---
dlls/wbemprox/reg.c | 20 +--
dlls/wbemprox/services.c | 70 ++++----
dlls/wbemprox/table.c | 16 +-
dlls/wbemprox/tests/query.c | 5 +-
dlls/wbemprox/wbemlocator.c | 21 ++-
dlls/wbemprox/wbemprox_private.h | 5 +-
dlls/wbemprox/wql.y | 2 +-
11 files changed, 270 insertions(+), 277 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 5a09d64b8fb..c71bab80ee2 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -1055,7 +1055,7 @@ static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
{
if (!table->num_rows_allocated)
{
- if (!(table->data = heap_alloc( row_count * row_size ))) return FALSE;
+ if (!(table->data = malloc( row_count * row_size ))) return FALSE;
table->num_rows_allocated = row_count;
return TRUE;
}
@@ -1063,7 +1063,7 @@ static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
{
BYTE *data;
UINT count = max( row_count, table->num_rows_allocated * 2 );
- if (!(data = heap_realloc( table->data, count * row_size ))) return FALSE;
+ if (!(data = realloc( table->data, count * row_size ))) return FALSE;
table->data = data;
table->num_rows_allocated = count;
}
@@ -1250,7 +1250,7 @@ static enum fill_status fill_baseboard( struct table *table, const struct expr *
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
- if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
+ if (!(buf = malloc( len ))) return FILL_STATUS_FAILED;
GetSystemFirmwareTable( RSMB, 0, buf, len );
rec = (struct record_baseboard *)table->data;
@@ -1264,7 +1264,7 @@ static enum fill_status fill_baseboard( struct table *table, const struct expr *
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;
- heap_free( buf );
+ free( buf );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -1331,7 +1331,7 @@ static WCHAR *convert_bios_date( const WCHAR *str )
else if (q - p == 2) year = 1900 + (p[0] - '0') * 10 + p[1] - '0';
else return NULL;
- if (!(ret = heap_alloc( sizeof(fmtW) ))) return NULL;
+ if (!(ret = malloc( sizeof(fmtW) ))) return NULL;
swprintf( ret, ARRAY_SIZE(fmtW), fmtW, year, month, day );
return ret;
}
@@ -1340,7 +1340,7 @@ static WCHAR *get_bios_releasedate( const char *buf, UINT len )
{
WCHAR *ret, *date = get_bios_string( 3, buf, len );
if (!date || !(ret = convert_bios_date( date ))) ret = heap_strdupW( L"20120608000000.000000+000" );
- heap_free( date );
+ free( date );
return ret;
}
@@ -1409,7 +1409,7 @@ static enum fill_status fill_bios( struct table *table, const struct expr *cond
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
- if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
+ if (!(buf = malloc( len ))) return FILL_STATUS_FAILED;
GetSystemFirmwareTable( RSMB, 0, buf, len );
rec = (struct record_bios *)table->data;
@@ -1431,7 +1431,7 @@ static enum fill_status fill_bios( struct table *table, const struct expr *cond
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;
- heap_free( buf );
+ free( buf );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -1500,11 +1500,11 @@ static UINT get_logical_processor_count( UINT *num_physical, UINT *num_packages
status = NtQuerySystemInformationEx( SystemLogicalProcessorInformationEx, &all, sizeof(all), NULL, 0, &len );
if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count();
- if (!(buf = heap_alloc( len ))) return get_processor_count();
+ if (!(buf = malloc( len ))) return get_processor_count();
status = NtQuerySystemInformationEx( SystemLogicalProcessorInformationEx, &all, sizeof(all), buf, len, NULL );
if (status != STATUS_SUCCESS)
{
- heap_free( buf );
+ free( buf );
return get_processor_count();
}
@@ -1524,7 +1524,7 @@ static UINT get_logical_processor_count( UINT *num_physical, UINT *num_packages
offset += entry->Size;
}
- heap_free( buf );
+ free( buf );
if (num_physical) *num_physical = core_relation_count;
if (num_packages) *num_packages = package_relation_count;
return smt_enabled ? core_relation_count * 2 : core_relation_count;
@@ -1553,7 +1553,7 @@ static WCHAR *get_computername(void)
WCHAR *ret;
DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
- if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( size * sizeof(WCHAR) ))) return NULL;
GetComputerNameW( ret, &size );
return ret;
}
@@ -1569,7 +1569,7 @@ static WCHAR *get_username(void)
usersize = 0;
GetUserNameW( NULL, &usersize );
size = compsize + usersize; /* two null terminators account for the \ */
- if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( size * sizeof(WCHAR) ))) return NULL;
GetComputerNameW( ret, &compsize );
ret[compsize] = '\\';
GetUserNameW( ret + compsize + 1, &usersize );
@@ -1639,7 +1639,7 @@ static WCHAR *get_compsysproduct_uuid( const char *buf, UINT len )
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_SYSTEM, buf, len )) || hdr->length < sizeof(*system)) goto done;
system = (const struct smbios_system *)hdr;
- if (!memcmp( system->uuid, none, sizeof(none) ) || !(ret = heap_alloc( 37 * sizeof(WCHAR) ))) goto done;
+ if (!memcmp( system->uuid, none, sizeof(none) ) || !(ret = malloc( 37 * sizeof(WCHAR) ))) goto done;
ptr = system->uuid;
swprintf( ret, 37, L"%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", ptr[0], ptr[1],
@@ -1674,7 +1674,7 @@ static enum fill_status fill_compsysproduct( struct table *table, const struct e
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
- if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
+ if (!(buf = malloc( len ))) return FILL_STATUS_FAILED;
GetSystemFirmwareTable( RSMB, 0, buf, len );
rec = (struct record_computersystemproduct *)table->data;
@@ -1687,7 +1687,7 @@ static enum fill_status fill_compsysproduct( struct table *table, const struct e
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;
- heap_free( buf );
+ free( buf );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -1706,16 +1706,16 @@ static struct dirstack *alloc_dirstack( UINT size )
{
struct dirstack *dirstack;
- if (!(dirstack = heap_alloc( sizeof(*dirstack) ))) return NULL;
- if (!(dirstack->dirs = heap_alloc( sizeof(WCHAR *) * size )))
+ if (!(dirstack = malloc( sizeof(*dirstack) ))) return NULL;
+ if (!(dirstack->dirs = malloc( sizeof(WCHAR *) * size )))
{
- heap_free( dirstack );
+ free( dirstack );
return NULL;
}
- if (!(dirstack->len_dirs = heap_alloc( sizeof(UINT) * size )))
+ if (!(dirstack->len_dirs = malloc( sizeof(UINT) * size )))
{
- heap_free( dirstack->dirs );
- heap_free( dirstack );
+ free( dirstack->dirs );
+ free( dirstack );
return NULL;
}
dirstack->num_dirs = 0;
@@ -1726,16 +1726,16 @@ static struct dirstack *alloc_dirstack( UINT size )
static void clear_dirstack( struct dirstack *dirstack )
{
UINT i;
- for (i = 0; i < dirstack->num_dirs; i++) heap_free( dirstack->dirs[i] );
+ for (i = 0; i < dirstack->num_dirs; i++) free( dirstack->dirs[i] );
dirstack->num_dirs = 0;
}
static void free_dirstack( struct dirstack *dirstack )
{
clear_dirstack( dirstack );
- heap_free( dirstack->dirs );
- heap_free( dirstack->len_dirs );
- heap_free( dirstack );
+ free( dirstack->dirs );
+ free( dirstack->len_dirs );
+ free( dirstack );
}
static BOOL push_dir( struct dirstack *dirstack, WCHAR *dir, UINT len )
@@ -1750,9 +1750,9 @@ static BOOL push_dir( struct dirstack *dirstack, WCHAR *dir, UINT len )
UINT *len_tmp;
size = dirstack->num_allocated * 2;
- if (!(tmp = heap_realloc( dirstack->dirs, size * sizeof(WCHAR *) ))) return FALSE;
+ if (!(tmp = realloc( dirstack->dirs, size * sizeof(WCHAR *) ))) return FALSE;
dirstack->dirs = tmp;
- if (!(len_tmp = heap_realloc( dirstack->len_dirs, size * sizeof(UINT) ))) return FALSE;
+ if (!(len_tmp = realloc( dirstack->len_dirs, size * sizeof(UINT) ))) return FALSE;
dirstack->len_dirs = len_tmp;
dirstack->num_allocated = size;
}
@@ -1785,7 +1785,7 @@ static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len )
UINT i = 0;
WCHAR *ret;
- if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
ret[i++] = drive;
ret[i++] = ':';
ret[i++] = '\\';
@@ -1811,7 +1811,7 @@ static WCHAR *build_name( WCHAR drive, const WCHAR *path )
if (*p == '\\') len += 2;
else len++;
};
- if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
ret[i++] = drive;
ret[i++] = ':';
ret[i++] = '\\';
@@ -1844,7 +1844,7 @@ static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
while (p >= start && *p != '\\') { len--; p--; };
while (p >= start && *p == '\\') { len--; p--; };
- if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
for (i = 0, p = start; p < start + len; p++)
{
if (p[0] == '\\' && p[1] == '\\')
@@ -1897,11 +1897,11 @@ static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR
{
if (seen_dir( dirstack, path ))
{
- heap_free( path );
+ free( path );
return ++*count;
}
else if (push_dir( dirstack, path, len )) return ++*count;
- heap_free( path );
+ free( path );
return *count = 0;
}
}
@@ -1923,7 +1923,7 @@ static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len )
*len = 0;
if (path) len_path = lstrlenW( path );
- if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
if (path && len_path)
{
memcpy( ret, path, len_path * sizeof(WCHAR) );
@@ -1943,22 +1943,22 @@ static WCHAR *get_file_version( const WCHAR *filename )
void *block;
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
- if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size )))
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = malloc( size )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
if (!GetFileVersionInfoW( filename, 0, size, block ) ||
!VerQueryValueW( block, L"\\", (void **)&info, &size ))
{
- heap_free( block );
- heap_free( ret );
+ free( block );
+ free( ret );
return NULL;
}
swprintf( ret, len, L"%u.%u.%u.%u", info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff,
info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff );
- heap_free( block );
+ free( block );
return ret;
}
@@ -1989,8 +1989,8 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
for (;;)
{
- heap_free( glob );
- heap_free( path );
+ free( glob );
+ free( path );
path = pop_dir( dirstack, &len );
if (!(glob = build_glob( root[0], path, len )))
{
@@ -2019,7 +2019,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (push_dir( dirstack, new_path, len )) continue;
- heap_free( new_path );
+ free( new_path );
FindClose( handle );
status = FILL_STATUS_FAILED;
goto done;
@@ -2027,7 +2027,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
rec = (struct record_datafile *)(table->data + offset);
rec->name = build_name( root[0], new_path );
rec->version = get_file_version( rec->name );
- heap_free( new_path );
+ free( new_path );
if (!match_row( table, row, cond, &status ))
{
free_row_values( table, row );
@@ -2052,8 +2052,8 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
done:
free_dirstack( dirstack );
- heap_free( glob );
- heap_free( path );
+ free( glob );
+ free( path );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -2117,8 +2117,8 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
for (;;)
{
- heap_free( glob );
- heap_free( path );
+ free( glob );
+ free( path );
path = pop_dir( dirstack, &len );
if (!(glob = build_glob( root[0], path, len )))
{
@@ -2148,7 +2148,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
if (!(push_dir( dirstack, new_path, len )))
{
- heap_free( new_path );
+ free( new_path );
FindClose( handle );
status = FILL_STATUS_FAILED;
goto done;
@@ -2156,7 +2156,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
rec = (struct record_directory *)(table->data + offset);
rec->accessmask = FILE_ALL_ACCESS;
rec->name = build_name( root[0], new_path );
- heap_free( new_path );
+ free( new_path );
if (!match_row( table, row, cond, &status ))
{
free_row_values( table, row );
@@ -2181,8 +2181,8 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
done:
free_dirstack( dirstack );
- heap_free( glob );
- heap_free( path );
+ free( glob );
+ free( path );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -2229,15 +2229,15 @@ static WCHAR *get_diskdrive_serialnumber( WCHAR letter )
size = sizeof(*desc) + 256;
for (;;)
{
- if (!(desc = heap_alloc( size ))) break;
+ if (!(desc = malloc( size ))) break;
if (DeviceIoControl( handle, IOCTL_STORAGE_QUERY_PROPERTY, &query, sizeof(query), desc, size, NULL, NULL ))
{
if (desc->SerialNumberOffset) ret = heap_strdupAW( (const char *)desc + desc->SerialNumberOffset );
- heap_free( desc );
+ free( desc );
break;
}
size = desc->Size;
- heap_free( desc );
+ free( desc );
if (GetLastError() != ERROR_MORE_DATA) break;
}
@@ -2308,10 +2308,10 @@ static void free_associations( struct association *assoc, UINT count )
if (!assoc) return;
for (i = 0; i < count; i++)
{
- heap_free( assoc[i].ref );
- heap_free( assoc[i].ref2 );
+ free( assoc[i].ref );
+ free( assoc[i].ref2 );
}
- heap_free( assoc );
+ free( assoc );
}
static struct association *get_diskdrivetodiskpartition_pairs( UINT *count )
@@ -2332,7 +2332,7 @@ static struct association *get_diskdrivetodiskpartition_pairs( UINT *count )
&query2->view, &query2->mem )) != S_OK) goto done;
if ((hr = execute_view( query2->view )) != S_OK) goto done;
- if (!(ret = heap_alloc_zero( query->view->result_count * sizeof(*ret) ))) goto done;
+ if (!(ret = calloc( query->view->result_count, sizeof(*ret) ))) goto done;
for (i = 0; i < query->view->result_count; i++)
{
@@ -2387,7 +2387,7 @@ static enum fill_status fill_diskdrivetodiskpartition( struct table *table, cons
row++;
}
- heap_free( assoc );
+ free( assoc );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -2491,7 +2491,7 @@ static WCHAR *get_ip4_string( DWORD addr )
DWORD len = sizeof("ddd.ddd.ddd.ddd");
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( ret, len, L"%u.%u.%u.%u", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff );
return ret;
}
@@ -2504,15 +2504,15 @@ static enum fill_status fill_ip4routetable( struct table *table, const struct ex
enum fill_status status = FILL_STATUS_UNFILTERED;
if (GetIpForwardTable( NULL, &size, TRUE ) != ERROR_INSUFFICIENT_BUFFER) return FILL_STATUS_FAILED;
- if (!(forwards = heap_alloc( size ))) return FILL_STATUS_FAILED;
+ if (!(forwards = malloc( size ))) return FILL_STATUS_FAILED;
if (GetIpForwardTable( forwards, &size, TRUE ))
{
- heap_free( forwards );
+ free( forwards );
return FILL_STATUS_FAILED;
}
if (!resize_table( table, max(forwards->dwNumEntries, 1), sizeof(*rec) ))
{
- heap_free( forwards );
+ free( forwards );
return FILL_STATUS_FAILED;
}
@@ -2535,7 +2535,7 @@ static enum fill_status fill_ip4routetable( struct table *table, const struct ex
TRACE("created %u rows\n", row);
table->num_rows = row;
- heap_free( forwards );
+ free( forwards );
return status;
}
@@ -2621,7 +2621,7 @@ static struct association *get_logicaldisktopartition_pairs( UINT *count )
&query2->mem )) != S_OK) goto done;
if ((hr = execute_view( query2->view )) != S_OK) goto done;
- if (!(ret = heap_alloc_zero( query->view->result_count * sizeof(*ret) ))) goto done;
+ if (!(ret = calloc( query->view->result_count, sizeof(*ret) ))) goto done;
/* assume fixed and removable disks are enumerated in the same order as partitions */
for (i = 0; i < query->view->result_count; i++)
@@ -2677,7 +2677,7 @@ static enum fill_status fill_logicaldisktopartition( struct table *table, const
row++;
}
- heap_free( assoc );
+ free( assoc );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -2701,7 +2701,7 @@ static UINT16 get_connection_status( IF_OPER_STATUS status )
static WCHAR *get_mac_address( const BYTE *addr, DWORD len )
{
WCHAR *ret;
- if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
+ if (len != 6 || !(ret = malloc( 18 * sizeof(WCHAR) ))) return NULL;
swprintf( ret, 18, L"%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
return ret;
}
@@ -2740,7 +2740,7 @@ static const WCHAR *get_adaptertype( DWORD type, int *id, int *physical )
static WCHAR *guid_to_str( const GUID *ptr )
{
WCHAR *ret;
- if (!(ret = heap_alloc( GUID_SIZE * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( GUID_SIZE * sizeof(WCHAR) ))) return NULL;
swprintf( ret, GUID_SIZE, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
ptr->Data1, ptr->Data2, ptr->Data3, ptr->Data4[0], ptr->Data4[1], ptr->Data4[2],
ptr->Data4[3], ptr->Data4[4], ptr->Data4[5], ptr->Data4[6], ptr->Data4[7] );
@@ -2767,10 +2767,10 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
- if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
+ if (!(buffer = malloc( size ))) return FILL_STATUS_FAILED;
if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
{
- heap_free( buffer );
+ free( buffer );
return FILL_STATUS_FAILED;
}
for (aa = buffer; aa; aa = aa->Next)
@@ -2779,7 +2779,7 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
}
if (!resize_table( table, count, sizeof(*rec) ))
{
- heap_free( buffer );
+ free( buffer );
return FILL_STATUS_FAILED;
}
for (aa = buffer; aa; aa = aa->Next)
@@ -2814,7 +2814,7 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
TRACE("created %u rows\n", row);
table->num_rows = row;
- heap_free( buffer );
+ free( buffer );
return status;
}
@@ -2838,10 +2838,10 @@ static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list )
if (!list) return NULL;
for (gateway = list; gateway; gateway = gateway->Next) count++;
- if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
- if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
+ if (!(ret = malloc( sizeof(*ret) ))) return NULL;
+ if (!(ptr = malloc( sizeof(*ptr) * count )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
for (gateway = list; gateway; gateway = gateway->Next)
@@ -2850,9 +2850,9 @@ static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list )
if (WSAAddressToStringW( gateway->Address.lpSockaddr, gateway->Address.iSockaddrLength,
NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf )))
{
- for (; i > 0; i--) heap_free( ptr[i - 1] );
- heap_free( ptr );
- heap_free( ret );
+ for (; i > 0; i--) free( ptr[i - 1] );
+ free( ptr );
+ free( ret );
return NULL;
}
}
@@ -2871,10 +2871,10 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li
if (!list) return NULL;
for (server = list; server; server = server->Next) count++;
- if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
- if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
+ if (!(ret = malloc( sizeof(*ret) ))) return NULL;
+ if (!(ptr = malloc( sizeof(*ptr) * count )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
for (server = list; server; server = server->Next)
@@ -2883,9 +2883,9 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li
if (WSAAddressToStringW( server->Address.lpSockaddr, server->Address.iSockaddrLength,
NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf )))
{
- for (; i > 0; i--) heap_free( ptr[i - 1] );
- heap_free( ptr );
- heap_free( ret );
+ for (; i > 0; i--) free( ptr[i - 1] );
+ free( ptr );
+ free( ret );
return NULL;
}
if ((p = wcsrchr( ptr[i - 1], ':' ))) *p = 0;
@@ -2905,10 +2905,10 @@ static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
if (!list) return NULL;
for (address = list; address; address = address->Next) count++;
- if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
- if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
+ if (!(ret = malloc( sizeof(*ret) ))) return NULL;
+ if (!(ptr = malloc( sizeof(*ptr) * count )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
for (address = list; address; address = address->Next)
@@ -2917,9 +2917,9 @@ static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
if (WSAAddressToStringW( address->Address.lpSockaddr, address->Address.iSockaddrLength,
NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf )))
{
- for (; i > 0; i--) heap_free( ptr[i - 1] );
- heap_free( ptr );
- heap_free( ret );
+ for (; i > 0; i--) free( ptr[i - 1] );
+ free( ptr );
+ free( ret );
return NULL;
}
}
@@ -2938,10 +2938,10 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
if (!list) return NULL;
for (address = list; address; address = address->Next) count++;
- if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
- if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
+ if (!(ret = malloc( sizeof(*ret) ))) return NULL;
+ if (!(ptr = malloc( sizeof(*ptr) * count )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
for (address = list; address; address = address->Next)
@@ -2968,9 +2968,9 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
}
if (!ptr[i++])
{
- for (; i > 0; i--) heap_free( ptr[i - 1] );
- heap_free( ptr );
- heap_free( ret );
+ for (; i > 0; i--) free( ptr[i - 1] );
+ free( ptr );
+ free( ret );
return NULL;
}
}
@@ -2998,10 +2998,10 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
ret = GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, NULL, &size );
if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
- if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
+ if (!(buffer = malloc( size ))) return FILL_STATUS_FAILED;
if (GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, buffer, &size ))
{
- heap_free( buffer );
+ free( buffer );
return FILL_STATUS_FAILED;
}
for (aa = buffer; aa; aa = aa->Next)
@@ -3010,7 +3010,7 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
}
if (!resize_table( table, count, sizeof(*rec) ))
{
- heap_free( buffer );
+ free( buffer );
return FILL_STATUS_FAILED;
}
for (aa = buffer; aa; aa = aa->Next)
@@ -3042,7 +3042,7 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
TRACE("created %u rows\n", row);
table->num_rows = row;
- heap_free( buffer );
+ free( buffer );
return status;
}
@@ -3132,15 +3132,15 @@ static enum fill_status fill_printer( struct table *table, const struct expr *co
EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count );
if (!count) return FILL_STATUS_UNFILTERED;
- if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
+ if (!(info = malloc( size ))) return FILL_STATUS_FAILED;
if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count ))
{
- heap_free( info );
+ free( info );
return FILL_STATUS_FAILED;
}
if (!resize_table( table, count, sizeof(*rec) ))
{
- heap_free( info );
+ free( info );
return FILL_STATUS_FAILED;
}
@@ -3168,7 +3168,7 @@ static enum fill_status fill_printer( struct table *table, const struct expr *co
TRACE("created %u rows\n", num_rows);
table->num_rows = num_rows;
- heap_free( info );
+ free( info );
return status;
}
@@ -3345,11 +3345,11 @@ static UINT get_processor_currentclockspeed( UINT index )
UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
NTSTATUS status;
- if ((info = heap_alloc( size )))
+ if ((info = malloc( size )))
{
status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
if (!status) ret = info[index].CurrentMhz;
- heap_free( info );
+ free( info );
}
return ret;
}
@@ -3359,11 +3359,11 @@ static UINT get_processor_maxclockspeed( UINT index )
UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
NTSTATUS status;
- if ((info = heap_alloc( size )))
+ if ((info = malloc( size )))
{
status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
if (!status) ret = info[index].MaxMhz;
- heap_free( info );
+ free( info );
}
return ret;
}
@@ -3429,7 +3429,7 @@ static WCHAR *get_lastbootuptime(void)
TIME_FIELDS tf;
WCHAR *ret;
- if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( 26 * sizeof(WCHAR) ))) return NULL;
NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
RtlTimeToTimeFields( &ti.BootTime, &tf );
@@ -3453,7 +3453,7 @@ static WCHAR *get_localdatetime(void)
Bias+= tzi.DaylightBias;
else
Bias+= tzi.StandardBias;
- if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( 26 * sizeof(WCHAR) ))) return NULL;
GetLocalTime(&st);
swprintf( ret, 26, L"%04u%02u%02u%02u%02u%02u.%06u%+03d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute,
@@ -3465,7 +3465,7 @@ static WCHAR *get_systemdirectory(void)
void *redir;
WCHAR *ret;
- if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
Wow64DisableWow64FsRedirection( &redir );
GetSystemDirectoryW( ret, MAX_PATH );
Wow64RevertWow64FsRedirection( redir );
@@ -3473,32 +3473,32 @@ static WCHAR *get_systemdirectory(void)
}
static WCHAR *get_systemdrive(void)
{
- WCHAR *ret = heap_alloc( 3 * sizeof(WCHAR) ); /* "c:" */
+ WCHAR *ret = malloc( 3 * sizeof(WCHAR) ); /* "c:" */
if (ret && GetEnvironmentVariableW( L"SystemDrive", ret, 3 )) return ret;
- heap_free( ret );
+ free( ret );
return NULL;
}
static WCHAR *get_codeset(void)
{
- WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
+ WCHAR *ret = malloc( 11 * sizeof(WCHAR) );
if (ret) swprintf( ret, 11, L"%u", GetACP() );
return ret;
}
static WCHAR *get_countrycode(void)
{
- WCHAR *ret = heap_alloc( 6 * sizeof(WCHAR) );
+ WCHAR *ret = malloc( 6 * sizeof(WCHAR) );
if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, ret, 6 );
return ret;
}
static WCHAR *get_locale(void)
{
- WCHAR *ret = heap_alloc( 5 * sizeof(WCHAR) );
+ WCHAR *ret = malloc( 5 * sizeof(WCHAR) );
if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, ret, 5 );
return ret;
}
static WCHAR *get_osbuildnumber( OSVERSIONINFOEXW *ver )
{
- WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
+ WCHAR *ret = malloc( 11 * sizeof(WCHAR) );
if (ret) swprintf( ret, 11, L"%u", ver->dwBuildNumber );
return ret;
}
@@ -3519,7 +3519,7 @@ static WCHAR *get_oscaption( OSVERSIONINFOEXW *ver )
int len = ARRAY_SIZE( windowsW ) - 1;
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(win2003W) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) + sizeof(win2003W) ))) return NULL;
memcpy( ret, windowsW, sizeof(windowsW) );
if (ver->dwMajorVersion == 10 && ver->dwMinorVersion == 0) memcpy( ret + len, win10W, sizeof(win10W) );
else if (ver->dwMajorVersion == 6 && ver->dwMinorVersion == 3) memcpy( ret + len, win81W, sizeof(win81W) );
@@ -3549,7 +3549,7 @@ static WCHAR *get_osname( const WCHAR *caption )
int len = lstrlenW( caption );
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(partitionW) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) + sizeof(partitionW) ))) return NULL;
memcpy( ret, caption, len * sizeof(WCHAR) );
memcpy( ret + len, partitionW, sizeof(partitionW) );
return ret;
@@ -3562,12 +3562,12 @@ static WCHAR *get_osserialnumber(void)
if (!RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &hkey ) &&
!RegQueryValueExW( hkey, L"ProductId", NULL, &type, NULL, &size ) && type == REG_SZ &&
- (ret = heap_alloc( size + sizeof(WCHAR) )))
+ (ret = malloc( size + sizeof(WCHAR) )))
{
size += sizeof(WCHAR);
if (RegQueryValueExW( hkey, L"ProductId", NULL, NULL, (BYTE *)ret, &size ))
{
- heap_free( ret );
+ free( ret );
ret = NULL;
}
}
@@ -3577,7 +3577,7 @@ static WCHAR *get_osserialnumber(void)
}
static WCHAR *get_osversion( OSVERSIONINFOEXW *ver )
{
- WCHAR *ret = heap_alloc( 33 * sizeof(WCHAR) );
+ WCHAR *ret = malloc( 33 * sizeof(WCHAR) );
if (ret) swprintf( ret, 33, L"%u.%u.%u", ver->dwMajorVersion, ver->dwMinorVersion, ver->dwBuildNumber );
return ret;
}
@@ -3693,9 +3693,9 @@ static QUERY_SERVICE_CONFIGW *query_service_config( SC_HANDLE manager, const WCH
if (!(service = OpenServiceW( manager, name, SERVICE_QUERY_CONFIG ))) return NULL;
QueryServiceConfigW( service, NULL, 0, &size );
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
- if (!(config = heap_alloc( size ))) goto done;
+ if (!(config = malloc( size ))) goto done;
if (QueryServiceConfigW( service, config, size, &size )) goto done;
- heap_free( config );
+ free( config );
config = NULL;
done:
@@ -3716,7 +3716,7 @@ static enum fill_status fill_service( struct table *table, const struct expr *co
BOOL ret;
if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) return FILL_STATUS_FAILED;
- if (!(services = heap_alloc( size ))) goto done;
+ if (!(services = malloc( size ))) goto done;
ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
@@ -3725,7 +3725,7 @@ static enum fill_status fill_service( struct table *table, const struct expr *co
{
if (GetLastError() != ERROR_MORE_DATA) goto done;
size = needed;
- if (!(tmp = heap_realloc( services, size ))) goto done;
+ if (!(tmp = realloc( services, size ))) goto done;
services = tmp;
ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
@@ -3758,7 +3758,7 @@ static enum fill_status fill_service( struct table *table, const struct expr *co
rec->resume_service = service_resume_service;
rec->start_service = service_start_service;
rec->stop_service = service_stop_service;
- heap_free( config );
+ free( config );
if (!match_row( table, row, cond, &fill_status ))
{
free_row_values( table, row );
@@ -3773,7 +3773,7 @@ static enum fill_status fill_service( struct table *table, const struct expr *co
done:
CloseServiceHandle( manager );
- heap_free( services );
+ free( services );
return fill_status;
}
@@ -3787,10 +3787,10 @@ static struct array *get_binaryrepresentation( PSID sid, UINT len )
struct array *ret;
UINT8 *ptr;
- if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
- if (!(ptr = heap_alloc( len )))
+ if (!(ret = malloc( sizeof(*ret) ))) return NULL;
+ if (!(ptr = malloc( len )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
memcpy( ptr, sid, len );
@@ -3906,10 +3906,10 @@ static int get_systemenclosure_lockpresent( const char *buf, UINT len )
static struct array *dup_array( const struct array *src )
{
struct array *dst;
- if (!(dst = heap_alloc( sizeof(*dst) ))) return NULL;
- if (!(dst->ptr = heap_alloc( src->count * src->elem_size )))
+ if (!(dst = malloc( sizeof(*dst) ))) return NULL;
+ if (!(dst->ptr = malloc( src->count * src->elem_size )))
{
- heap_free( dst );
+ free( dst );
return NULL;
}
memcpy( dst->ptr, src->ptr, src->count * src->elem_size );
@@ -3928,10 +3928,10 @@ static struct array *get_systemenclosure_chassistypes( const char *buf, UINT len
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_CHASSIS, buf, len )) || hdr->length < sizeof(*chassis)) goto done;
chassis = (const struct smbios_chassis *)hdr;
- if (!(ret = heap_alloc( sizeof(*ret) ))) goto done;
- if (!(types = heap_alloc( sizeof(*types) )))
+ if (!(ret = malloc( sizeof(*ret) ))) goto done;
+ if (!(types = malloc( sizeof(*types) )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
types[0] = chassis->type & ~0x80;
@@ -3955,7 +3955,7 @@ static enum fill_status fill_systemenclosure( struct table *table, const struct
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
- if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
+ if (!(buf = malloc( len ))) return FILL_STATUS_FAILED;
GetSystemFirmwareTable( RSMB, 0, buf, len );
rec = (struct record_systemenclosure *)table->data;
@@ -3969,7 +3969,7 @@ static enum fill_status fill_systemenclosure( struct table *table, const struct
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;
- heap_free( buf );
+ free( buf );
TRACE("created %u rows\n", row);
table->num_rows = row;
@@ -3982,7 +3982,7 @@ static WCHAR *get_videocontroller_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
UINT len = sizeof(fmtW) + 2;
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( ret, len, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
return ret;
}
@@ -4082,7 +4082,7 @@ static WCHAR *get_sounddevice_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
UINT len = sizeof(fmtW) + 2;
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( ret, len, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
return ret;
}
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index cabf1c9058d..6f93c58a0df 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -61,7 +61,7 @@ static ULONG WINAPI enum_class_object_Release(
{
TRACE("destroying %p\n", ec);
release_query( ec->query );
- heap_free( ec );
+ free( ec );
}
return refs;
}
@@ -205,8 +205,7 @@ HRESULT EnumWbemClassObject_create( struct query *query, LPVOID *ppObj )
TRACE("%p\n", ppObj);
- ec = heap_alloc( sizeof(*ec) );
- if (!ec) return E_OUTOFMEMORY;
+ if (!(ec = malloc( sizeof(*ec) ))) return E_OUTOFMEMORY;
ec->IEnumWbemClassObject_iface.lpVtbl = &enum_class_object_vtbl;
ec->refs = 1;
@@ -225,10 +224,10 @@ static struct record *create_record( struct table *table )
UINT i;
struct record *record;
- if (!(record = heap_alloc( sizeof(struct record) ))) return NULL;
- if (!(record->fields = heap_alloc( table->num_cols * sizeof(struct field) )))
+ if (!(record = malloc( sizeof(struct record) ))) return NULL;
+ if (!(record->fields = malloc( table->num_cols * sizeof(struct field) )))
{
- heap_free( record );
+ free( record );
return NULL;
}
for (i = 0; i < table->num_cols; i++)
@@ -247,10 +246,10 @@ void destroy_array( struct array *array, CIMTYPE type )
if (!array) return;
if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE)
{
- for (i = 0; i < array->count; i++) heap_free( *(WCHAR **)((char *)array->ptr + i * array->elem_size) );
+ for (i = 0; i < array->count; i++) free( *(WCHAR **)((char *)array->ptr + i * array->elem_size) );
}
- heap_free( array->ptr );
- heap_free( array );
+ free( array->ptr );
+ free( array );
}
static void destroy_record( struct record *record )
@@ -263,12 +262,12 @@ static void destroy_record( struct record *record )
{
if (record->fields[i].type == CIM_STRING ||
record->fields[i].type == CIM_DATETIME ||
- record->fields[i].type == CIM_REFERENCE) heap_free( record->fields[i].u.sval );
+ record->fields[i].type == CIM_REFERENCE) free( record->fields[i].u.sval );
else if (record->fields[i].type & CIM_FLAG_ARRAY)
destroy_array( record->fields[i].u.aval, record->fields[i].type & CIM_TYPE_MASK );
}
- heap_free( record->fields );
- heap_free( record );
+ free( record->fields );
+ free( record );
}
struct class_object
@@ -307,8 +306,8 @@ static ULONG WINAPI class_object_Release(
TRACE("destroying %p\n", co);
if (co->iter) IEnumWbemClassObject_Release( co->iter );
destroy_record( co->record );
- heap_free( co->name );
- heap_free( co );
+ free( co->name );
+ free( co );
}
return refs;
}
@@ -774,8 +773,8 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
int i = 0;
count = count_instances( iter );
- if (!(columns = heap_alloc( count * sizeof(struct column) ))) return E_OUTOFMEMORY;
- if (!(row = heap_alloc_zero( count * sizeof(LONGLONG) ))) goto error;
+ if (!(columns = malloc( count * sizeof(struct column) ))) return E_OUTOFMEMORY;
+ if (!(row = calloc( count, sizeof(LONGLONG) ))) goto error;
for (;;)
{
@@ -805,9 +804,9 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
return S_OK;
error:
- for (; i >= 0; i--) heap_free( (WCHAR *)columns[i].name );
- heap_free( columns );
- heap_free( row );
+ for (; i >= 0; i--) free( (WCHAR *)columns[i].name );
+ free( columns );
+ free( row );
return hr;
}
@@ -825,7 +824,7 @@ static HRESULT create_signature_table( IEnumWbemClassObject *iter, enum wbm_name
if (!(table = create_table( name, num_cols, columns, 1, 1, row, NULL )))
{
free_columns( columns, num_cols );
- heap_free( row );
+ free( row );
return E_OUTOFMEMORY;
}
if (!add_table( ns, table )) free_table( table ); /* already exists */
@@ -837,7 +836,7 @@ static WCHAR *build_signature_table_name( const WCHAR *class, const WCHAR *metho
UINT len = ARRAY_SIZE(L"__%s_%s_%s") + ARRAY_SIZE(L"OUT") + lstrlenW( class ) + lstrlenW( method );
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( ret, len, L"__%s_%s_%s", class, method, dir == PARAM_IN ? L"IN" : L"OUT" );
return wcsupr( ret );
}
@@ -852,11 +851,11 @@ HRESULT create_signature( enum wbm_namespace ns, const WCHAR *class, const WCHAR
HRESULT hr;
len += lstrlenW( class ) + lstrlenW( method );
- if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
+ if (!(query = malloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
swprintf( query, len, selectW, class, method, dir >= 0 ? L">=0" : L"<=0" );
hr = exec_query( ns, query, &iter );
- heap_free( query );
+ free( query );
if (hr != S_OK) return hr;
if (!count_instances( iter ))
@@ -876,7 +875,7 @@ HRESULT create_signature( enum wbm_namespace ns, const WCHAR *class, const WCHAR
if (hr == S_OK)
hr = get_object( ns, name, sig );
- heap_free( name );
+ free( name );
return hr;
}
@@ -1064,15 +1063,14 @@ HRESULT create_class_object( enum wbm_namespace ns, const WCHAR *name, IEnumWbem
TRACE("%s, %p\n", debugstr_w(name), obj);
- co = heap_alloc( sizeof(*co) );
- if (!co) return E_OUTOFMEMORY;
+ if (!(co = malloc( sizeof(*co) ))) return E_OUTOFMEMORY;
co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl;
co->refs = 1;
if (!name) co->name = NULL;
else if (!(co->name = heap_strdupW( name )))
{
- heap_free( co );
+ free( co );
return E_OUTOFMEMORY;
}
co->iter = iter;
diff --git a/dlls/wbemprox/qualifier.c b/dlls/wbemprox/qualifier.c
index 73075b85a06..aa032388759 100644
--- a/dlls/wbemprox/qualifier.c
+++ b/dlls/wbemprox/qualifier.c
@@ -60,9 +60,9 @@ static ULONG WINAPI qualifier_set_Release(
if (!refs)
{
TRACE("destroying %p\n", set);
- heap_free( set->class );
- heap_free( set->member );
- heap_free( set );
+ free( set->class );
+ free( set->member );
+ free( set );
}
return refs;
}
@@ -103,24 +103,24 @@ static HRESULT create_qualifier_enum( enum wbm_namespace ns, const WCHAR *class,
if (member && name)
{
len = lstrlenW( class ) + lstrlenW( member ) + lstrlenW( name ) + ARRAY_SIZE(fmtW);
- if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
+ if (!(query = malloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
swprintf( query, len, fmtW, class, member, name );
}
else if (member)
{
len = lstrlenW( class ) + lstrlenW( member ) + ARRAY_SIZE(fmt2W);
- if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
+ if (!(query = malloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
swprintf( query, len, fmt2W, class, member );
}
else
{
len = lstrlenW( class ) + ARRAY_SIZE(fmt3W);
- if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
+ if (!(query = malloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
swprintf( query, len, fmt3W, class );
}
hr = exec_query( ns, query, iter );
- heap_free( query );
+ free( query );
return hr;
}
@@ -279,19 +279,19 @@ HRESULT WbemQualifierSet_create( enum wbm_namespace ns, const WCHAR *class, cons
TRACE("%p\n", ppObj);
- if (!(set = heap_alloc( sizeof(*set) ))) return E_OUTOFMEMORY;
+ if (!(set = malloc( sizeof(*set) ))) return E_OUTOFMEMORY;
set->IWbemQualifierSet_iface.lpVtbl = &qualifier_set_vtbl;
if (!(set->class = heap_strdupW( class )))
{
- heap_free( set );
+ free( set );
return E_OUTOFMEMORY;
}
if (!member) set->member = NULL;
else if (!(set->member = heap_strdupW( member )))
{
- heap_free( set->class );
- heap_free( set );
+ free( set->class );
+ free( set );
return E_OUTOFMEMORY;
}
set->ns = ns;
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 63007565766..56631cbca9e 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
static HRESULT append_table( struct view *view, struct table *table )
{
struct table **tmp;
- if (!(tmp = heap_realloc( view->table, (view->table_count + 1) * sizeof(*tmp) ))) return E_OUTOFMEMORY;
+ if (!(tmp = realloc( view->table, (view->table_count + 1) * sizeof(*tmp) ))) return E_OUTOFMEMORY;
view->table = tmp;
view->table[view->table_count++] = table;
return S_OK;
@@ -41,7 +41,7 @@ static HRESULT append_table( struct view *view, struct table *table )
HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *path, const struct keyword *keywordlist,
const WCHAR *class, const struct property *proplist, const struct expr *cond, struct view **ret )
{
- struct view *view = heap_alloc_zero( sizeof(*view) );
+ struct view *view = calloc( 1, sizeof(*view) );
if (!view) return E_OUTOFMEMORY;
@@ -59,7 +59,7 @@ HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *pa
if (table && (hr = append_table( view, table )) != S_OK)
{
- heap_free( view );
+ free( view );
return hr;
}
else if (!table && ns == WBEMPROX_NAMESPACE_LAST) return WBEM_E_INVALID_CLASS;
@@ -69,7 +69,7 @@ HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *pa
}
default:
ERR( "unhandled type %u\n", type );
- heap_free( view );
+ free( view );
return E_INVALIDARG;
}
@@ -84,9 +84,9 @@ void destroy_view( struct view *view )
ULONG i;
if (!view) return;
for (i = 0; i < view->table_count; i++) release_table( view->table[i] );
- heap_free( view->table );
- heap_free( view->result );
- heap_free( view );
+ free( view->table );
+ free( view->result );
+ free( view );
}
static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr )
@@ -477,7 +477,7 @@ static WCHAR *build_assoc_query( const WCHAR *class, UINT class_len )
UINT len = class_len + ARRAY_SIZE(fmtW);
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( ret, len, fmtW, class );
return ret;
}
@@ -490,7 +490,7 @@ static HRESULT create_assoc_enum( enum wbm_namespace ns, const WCHAR *class, UIN
if (!(query = build_assoc_query( class, class_len ))) return E_OUTOFMEMORY;
hr = exec_query( ns, query, iter );
- heap_free( query );
+ free( query );
return hr;
}
@@ -500,7 +500,7 @@ static WCHAR *build_antecedent_query( const WCHAR *assocclass, const WCHAR *depe
UINT len = lstrlenW(assocclass) + lstrlenW(dependent) + ARRAY_SIZE(fmtW);
WCHAR *ret;
- if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( ret, len, fmtW, assocclass, dependent );
return ret;
}
@@ -534,7 +534,7 @@ static WCHAR *build_canonical_path( const WCHAR *relpath )
}
len = ARRAY_SIZE( L"\\\\%s\\%s:" ) + SysStringLen( server ) + SysStringLen( namespace ) + lstrlenW( relpath );
- if ((ret = heap_alloc( len * sizeof(WCHAR ) )))
+ if ((ret = malloc( len * sizeof(WCHAR ) )))
{
len = swprintf( ret, len, L"\\\\%s\\%s:", server, namespace );
for (i = 0; i < lstrlenW( relpath ); i ++)
@@ -577,8 +577,8 @@ static HRESULT get_antecedent( enum wbm_namespace ns, const WCHAR *assocclass, c
done:
if (iter) IEnumWbemClassObject_Release( iter );
- heap_free( str );
- heap_free( fullpath );
+ free( str );
+ free( fullpath );
return hr;
}
@@ -627,7 +627,7 @@ done:
if (query) release_query( query );
free_path( path );
SysFreeString( antecedent );
- heap_free( str );
+ free( str );
return hr;
}
@@ -671,7 +671,7 @@ static HRESULT exec_assoc_view( struct view *view )
if (view->table_count)
{
- if (!(view->result = heap_alloc_zero( view->table_count * sizeof(UINT) ))) hr = E_OUTOFMEMORY;
+ if (!(view->result = calloc( view->table_count, sizeof(UINT) ))) hr = E_OUTOFMEMORY;
else view->result_count = view->table_count;
}
@@ -699,7 +699,7 @@ static HRESULT exec_select_view( struct view *view )
if (!table->num_rows) return S_OK;
len = min( table->num_rows, 16 );
- if (!(view->result = heap_alloc( len * sizeof(UINT) ))) return E_OUTOFMEMORY;
+ if (!(view->result = malloc( len * sizeof(UINT) ))) return E_OUTOFMEMORY;
for (i = 0; i < table->num_rows; i++)
{
@@ -711,7 +711,7 @@ static HRESULT exec_select_view( struct view *view )
{
UINT *tmp;
len *= 2;
- if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY;
+ if (!(tmp = realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY;
view->result = tmp;
}
if (status == FILL_STATUS_FILTERED) val = 1;
@@ -743,7 +743,7 @@ struct query *create_query( enum wbm_namespace ns )
{
struct query *query;
- if (!(query = heap_alloc( sizeof(*query) ))) return NULL;
+ if (!(query = malloc( sizeof(*query) ))) return NULL;
list_init( &query->mem );
query->ns = ns;
query->refs = 1;
@@ -756,8 +756,8 @@ void free_query( struct query *query )
if (!query) return;
destroy_view( query->view );
- LIST_FOR_EACH_SAFE( mem, next, &query->mem ) { heap_free( mem ); }
- heap_free( query );
+ LIST_FOR_EACH_SAFE( mem, next, &query->mem ) { free( mem ); }
+ free( query );
}
struct query *addref_query( struct query *query )
@@ -811,7 +811,7 @@ static BSTR build_proplist( const struct table *table, UINT row, UINT count, UIN
UINT i, j, offset;
BSTR *values, ret = NULL;
- if (!(values = heap_alloc( count * sizeof(BSTR) ))) return NULL;
+ if (!(values = malloc( count * sizeof(BSTR) ))) return NULL;
*len = j = 0;
for (i = 0; i < table->num_cols; i++)
@@ -839,7 +839,7 @@ static BSTR build_proplist( const struct table *table, UINT row, UINT count, UIN
}
}
for (i = 0; i < count; i++) SysFreeString( values[i] );
- heap_free( values );
+ free( values );
return ret;
}
@@ -1278,13 +1278,13 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type )
if (SafeArrayGetVartype( V_ARRAY( var ), &vartype ) != S_OK) return NULL;
if (!(basetype = to_cimtype( vartype ))) return NULL;
if (SafeArrayGetUBound( V_ARRAY( var ), 1, &bound ) != S_OK) return NULL;
- if (!(ret = heap_alloc( sizeof(struct array) ))) return NULL;
+ if (!(ret = malloc( sizeof(struct array) ))) return NULL;
ret->count = bound + 1;
ret->elem_size = get_type_size( basetype );
- if (!(ret->ptr = heap_alloc_zero( ret->count * ret->elem_size )))
+ if (!(ret->ptr = calloc( ret->count, ret->elem_size )))
{
- heap_free( ret );
+ free( ret );
return NULL;
}
for (i = 0; i < ret->count; i++)
diff --git a/dlls/wbemprox/reg.c b/dlls/wbemprox/reg.c
index 361f0ec4b4a..eaa1db8bdde 100644
--- a/dlls/wbemprox/reg.c
+++ b/dlls/wbemprox/reg.c
@@ -171,11 +171,11 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo
TRACE("%p, %s\n", root, debugstr_w(subkey));
- if (!(strings = heap_alloc( count * sizeof(BSTR) ))) return E_OUTOFMEMORY;
+ if (!(strings = malloc( count * sizeof(BSTR) ))) return E_OUTOFMEMORY;
if ((res = RegOpenKeyExW( root, subkey, 0, KEY_ENUMERATE_SUB_KEYS | reg_get_access_mask( context ), &hkey )))
{
set_variant( VT_UI4, res, NULL, retval );
- heap_free( strings );
+ free( strings );
return S_OK;
}
for (;;)
@@ -183,7 +183,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo
if (i >= count)
{
count *= 2;
- if (!(tmp = heap_realloc( strings, count * sizeof(BSTR) )))
+ if (!(tmp = realloc( strings, count * sizeof(BSTR) )))
{
RegCloseKey( hkey );
return E_OUTOFMEMORY;
@@ -211,7 +211,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo
}
set_variant( VT_UI4, res, NULL, retval );
RegCloseKey( hkey );
- heap_free( strings );
+ free( strings );
return hr;
}
@@ -287,9 +287,9 @@ static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARI
goto done;
hr = E_OUTOFMEMORY;
- if (!(buf = heap_alloc( (buflen + 1) * sizeof(WCHAR) ))) goto done;
- if (!(value_names = heap_alloc( count * sizeof(BSTR) ))) goto done;
- if (!(value_types = heap_alloc( count * sizeof(DWORD) ))) goto done;
+ if (!(buf = malloc( (buflen + 1) * sizeof(WCHAR) ))) goto done;
+ if (!(value_names = malloc( count * sizeof(BSTR) ))) goto done;
+ if (!(value_types = malloc( count * sizeof(DWORD) ))) goto done;
hr = S_OK;
for (;;)
@@ -320,9 +320,9 @@ static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARI
done:
set_variant( VT_UI4, res, NULL, retval );
RegCloseKey( hkey );
- heap_free( value_names );
- heap_free( value_types );
- heap_free( buf );
+ free( value_names );
+ free( value_types );
+ free( buf );
return hr;
}
diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c
index 1c54cf3123e..5184bf4a4fa 100644
--- a/dlls/wbemprox/services.c
+++ b/dlls/wbemprox/services.c
@@ -168,7 +168,7 @@ static void free_async( struct async_header *async )
if (async->sink) IWbemObjectSink_Release( async->sink );
CloseHandle( async->cancel );
CloseHandle( async->wait );
- heap_free( async );
+ free( async );
}
static BOOL init_async( struct async_header *async, IWbemObjectSink *sink,
@@ -247,7 +247,7 @@ static ULONG WINAPI wbem_services_Release(
DeleteCriticalSection( &ws->cs );
if (ws->context)
IWbemContext_Release( ws->context );
- heap_free( ws );
+ free( ws );
}
return refs;
}
@@ -342,7 +342,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
const WCHAR *p = str, *q;
UINT len;
- if (!(path = heap_alloc_zero( sizeof(*path) ))) return E_OUTOFMEMORY;
+ if (!(path = calloc( 1, sizeof(*path) ))) return E_OUTOFMEMORY;
if (*p == '\\')
{
@@ -353,7 +353,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
p++;
if (*p != '\\')
{
- heap_free( path );
+ free( path );
return WBEM_E_INVALID_OBJECT_PATH;
}
p++;
@@ -362,14 +362,14 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*p && *p != '\\') p++;
if (!*p)
{
- heap_free( path );
+ free( path );
return WBEM_E_INVALID_OBJECT_PATH;
}
len = p - q;
if (!GetComputerNameW( server, &server_len ) || server_len != len || wcsnicmp( q, server, server_len ))
{
- heap_free( path );
+ free( path );
return WBEM_E_NOT_SUPPORTED;
}
@@ -377,14 +377,14 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*p && *p != ':') p++;
if (!*p)
{
- heap_free( path );
+ free( path );
return WBEM_E_INVALID_OBJECT_PATH;
}
len = p - q;
if (len != ARRAY_SIZE(cimv2W) - 1 || wcsnicmp( q, cimv2W, ARRAY_SIZE(cimv2W) - 1 ))
{
- heap_free( path );
+ free( path );
return WBEM_E_INVALID_NAMESPACE;
}
p++;
@@ -394,9 +394,9 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*p && *p != '.') p++;
len = p - q;
- if (!(path->class = heap_alloc( (len + 1) * sizeof(WCHAR) )))
+ if (!(path->class = malloc( (len + 1) * sizeof(WCHAR) )))
{
- heap_free( path );
+ free( path );
return E_OUTOFMEMORY;
}
memcpy( path->class, q, len * sizeof(WCHAR) );
@@ -409,10 +409,10 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*q) q++;
len = q - p;
- if (!(path->filter = heap_alloc( (len + 1) * sizeof(WCHAR) )))
+ if (!(path->filter = malloc( (len + 1) * sizeof(WCHAR) )))
{
- heap_free( path->class );
- heap_free( path );
+ free( path->class );
+ free( path );
return E_OUTOFMEMORY;
}
memcpy( path->filter, p, len * sizeof(WCHAR) );
@@ -426,9 +426,9 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
void free_path( struct path *path )
{
if (!path) return;
- heap_free( path->class );
- heap_free( path->filter );
- heap_free( path );
+ free( path->class );
+ free( path->filter );
+ free( path );
}
WCHAR *query_from_path( const struct path *path )
@@ -441,13 +441,13 @@ WCHAR *query_from_path( const struct path *path )
if (path->filter)
{
len = path->class_len + path->filter_len + ARRAY_SIZE(selectW);
- if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(query = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( query, len, selectW, path->class, path->filter );
}
else
{
len = path->class_len + ARRAY_SIZE(select_allW);
- if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ if (!(query = malloc( len * sizeof(WCHAR) ))) return NULL;
lstrcpyW( query, select_allW );
lstrcatW( query, path->class );
}
@@ -461,7 +461,7 @@ static HRESULT create_instance_enum( enum wbm_namespace ns, const struct path *p
if (!(query = query_from_path( path ))) return E_OUTOFMEMORY;
hr = exec_query( ns, query, iter );
- heap_free( query );
+ free( query );
return hr;
}
@@ -707,7 +707,7 @@ static void async_exec_query( struct async_header *hdr )
IEnumWbemClassObject_Release( result );
}
IWbemObjectSink_SetStatus( query->hdr.sink, WBEM_STATUS_COMPLETE, hr, NULL, NULL );
- heap_free( query->str );
+ free( query->str );
}
static HRESULT WINAPI wbem_services_ExecQueryAsync(
@@ -740,7 +740,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync(
hr = WBEM_E_FAILED;
goto done;
}
- if (!(query = heap_alloc_zero( sizeof(*query) ))) goto done;
+ if (!(query = calloc( 1, sizeof(*query) ))) goto done;
query->ns = services->ns;
async = (struct async_header *)query;
@@ -758,7 +758,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync(
if (hr == S_OK) services->async = async;
else
{
- heap_free( query->str );
+ free( query->str );
free_async( async );
}
@@ -810,7 +810,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync(
hr = WBEM_E_FAILED;
goto done;
}
- if (!(query = heap_alloc_zero( sizeof(*query) ))) goto done;
+ if (!(query = calloc( 1, sizeof(*query) ))) goto done;
async = (struct async_header *)query;
if (!(init_async( async, sink, async_exec_query )))
@@ -827,7 +827,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync(
if (hr == S_OK) services->async = async;
else
{
- heap_free( query->str );
+ free( query->str );
free_async( async );
}
@@ -896,7 +896,7 @@ done:
if (obj) IWbemClassObject_Release( obj );
free_query( query );
free_path( path );
- heap_free( str );
+ free( str );
return hr;
}
@@ -955,8 +955,7 @@ HRESULT WbemServices_create( const WCHAR *namespace, IWbemContext *context, LPVO
else if ((ns = get_namespace_from_string( namespace )) == WBEMPROX_NAMESPACE_LAST)
return WBEM_E_INVALID_NAMESPACE;
- ws = heap_alloc_zero( sizeof(*ws) );
- if (!ws) return E_OUTOFMEMORY;
+ if (!(ws = calloc( 1, sizeof(*ws) ))) return E_OUTOFMEMORY;
ws->IWbemServices_iface.lpVtbl = &wbem_services_vtbl;
ws->refs = 1;
@@ -994,8 +993,8 @@ static void wbem_context_delete_values(struct wbem_context *context)
{
list_remove( &value->entry );
VariantClear( &value->value );
- heap_free( value->name );
- heap_free( value );
+ free( value->name );
+ free( value );
}
}
@@ -1043,7 +1042,7 @@ static ULONG WINAPI wbem_context_Release(
{
TRACE("destroying %p\n", context);
wbem_context_delete_values( context );
- heap_free( context );
+ free( context );
}
return refs;
}
@@ -1152,16 +1151,16 @@ static HRESULT WINAPI wbem_context_SetValue(
}
else
{
- if (!(value = heap_alloc_zero( sizeof(*value) ))) return E_OUTOFMEMORY;
+ if (!(value = calloc( 1, sizeof(*value) ))) return E_OUTOFMEMORY;
if (!(value->name = heap_strdupW( name )))
{
- heap_free( value );
+ free( value );
return E_OUTOFMEMORY;
}
if (FAILED(hr = VariantCopy( &value->value, var )))
{
- heap_free( value->name );
- heap_free( value );
+ free( value->name );
+ free( value );
return hr;
}
@@ -1232,8 +1231,7 @@ HRESULT WbemContext_create( void **obj )
TRACE("(%p)\n", obj);
- context = heap_alloc( sizeof(*context) );
- if (!context) return E_OUTOFMEMORY;
+ if (!(context = malloc( sizeof(*context) ))) return E_OUTOFMEMORY;
context->IWbemContext_iface.lpVtbl = &wbem_context_vtbl;
context->refs = 1;
diff --git a/dlls/wbemprox/table.c b/dlls/wbemprox/table.c
index 02551af6eed..d08646a1c50 100644
--- a/dlls/wbemprox/table.c
+++ b/dlls/wbemprox/table.c
@@ -291,7 +291,7 @@ void free_row_values( const struct table *table, UINT row )
type = table->columns[i].type & COL_TYPE_MASK;
if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE)
{
- if (get_value( table, row, i, &val ) == S_OK) heap_free( (void *)(INT_PTR)val );
+ if (get_value( table, row, i, &val ) == S_OK) free( (void *)(INT_PTR)val );
}
else if (type & CIM_FLAG_ARRAY)
{
@@ -312,7 +312,7 @@ void clear_table( struct table *table )
{
table->num_rows = 0;
table->num_rows_allocated = 0;
- heap_free( table->data );
+ free( table->data );
table->data = NULL;
}
}
@@ -321,8 +321,8 @@ void free_columns( struct column *columns, UINT num_cols )
{
UINT i;
- for (i = 0; i < num_cols; i++) { heap_free( (WCHAR *)columns[i].name ); }
- heap_free( columns );
+ for (i = 0; i < num_cols; i++) { free( (WCHAR *)columns[i].name ); }
+ free( columns );
}
void free_table( struct table *table )
@@ -333,11 +333,11 @@ void free_table( struct table *table )
if (table->flags & TABLE_FLAG_DYNAMIC)
{
TRACE("destroying %p\n", table);
- heap_free( (WCHAR *)table->name );
+ free( (WCHAR *)table->name );
free_columns( (struct column *)table->columns, table->num_cols );
- heap_free( table->data );
+ free( table->data );
list_remove( &table->entry );
- heap_free( table );
+ free( table );
}
}
@@ -375,7 +375,7 @@ struct table *create_table( const WCHAR *name, UINT num_cols, const struct colum
{
struct table *table;
- if (!(table = heap_alloc( sizeof(*table) ))) return NULL;
+ if (!(table = malloc( sizeof(*table) ))) return NULL;
table->name = heap_strdupW( name );
table->num_cols = num_cols;
table->columns = columns;
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index a57a4398da3..954d39d244b 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -25,7 +25,6 @@
#include "initguid.h"
#include "objidl.h"
#include "wbemcli.h"
-#include "wine/heap.h"
#include "wine/test.h"
static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemClassObject **result )
@@ -195,7 +194,7 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services )
hr = IEnumWbemClassObject_Reset( result );
ok( hr == S_OK, "got %08x\n", hr );
- obj = heap_alloc( num_objects * sizeof( IWbemClassObject * ) );
+ obj = malloc( num_objects * sizeof( IWbemClassObject * ) );
count = 0;
hr = IEnumWbemClassObject_Next( result, 10000, num_objects, obj, &count );
@@ -216,7 +215,7 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services )
for (i = 0; i < count; i++)
IWbemClassObject_Release( obj[i] );
- heap_free( obj );
+ free( obj );
IEnumWbemClassObject_Release( result );
SysFreeString( query );
diff --git a/dlls/wbemprox/wbemlocator.c b/dlls/wbemprox/wbemlocator.c
index dc2a13deda3..58cb4a86991 100644
--- a/dlls/wbemprox/wbemlocator.c
+++ b/dlls/wbemprox/wbemlocator.c
@@ -56,7 +56,7 @@ static ULONG WINAPI wbem_locator_Release(
if (!refs)
{
TRACE("destroying %p\n", wl);
- heap_free( wl );
+ free( wl );
}
return refs;
}
@@ -113,7 +113,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
while (*q && *q != '\\' && *q != '/') q++;
if (!*q) return WBEM_E_INVALID_NAMESPACE;
len = q - p;
- if (!(*server = heap_alloc( (len + 1) * sizeof(WCHAR) )))
+ if (!(*server = malloc( (len + 1) * sizeof(WCHAR) )))
{
hr = E_OUTOFMEMORY;
goto done;
@@ -134,7 +134,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
}
q++;
len = lstrlenW( q );
- if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
+ if (!(*namespace = malloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
else
{
memcpy( *namespace, q, len * sizeof(WCHAR) );
@@ -145,8 +145,8 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
done:
if (hr != S_OK)
{
- heap_free( *server );
- heap_free( *namespace );
+ free( *server );
+ free( *namespace );
}
return hr;
}
@@ -174,8 +174,8 @@ static HRESULT WINAPI wbem_locator_ConnectServer(
if (!is_local_machine( server ))
{
FIXME("remote computer not supported\n");
- heap_free( server );
- heap_free( namespace );
+ free( server );
+ free( namespace );
return WBEM_E_TRANSPORT_FAILURE;
}
if (User || Password || Authority)
@@ -186,8 +186,8 @@ static HRESULT WINAPI wbem_locator_ConnectServer(
FIXME("unsupported flags\n");
hr = WbemServices_create( namespace, context, (void **)ppNamespace );
- heap_free( namespace );
- heap_free( server );
+ free( namespace );
+ free( server );
if (SUCCEEDED( hr ))
return WBEM_NO_ERROR;
@@ -208,8 +208,7 @@ HRESULT WbemLocator_create( LPVOID *ppObj )
TRACE("(%p)\n", ppObj);
- wl = heap_alloc( sizeof(*wl) );
- if (!wl) return E_OUTOFMEMORY;
+ if (!(wl = malloc( sizeof(*wl) ))) return E_OUTOFMEMORY;
wl->IWbemLocator_iface.lpVtbl = &wbem_locator_vtbl;
wl->refs = 1;
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index a2bf5071612..9e900132419 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -17,7 +17,6 @@
*/
#include "wine/debug.h"
-#include "wine/heap.h"
#include "wine/list.h"
enum wbm_namespace
@@ -280,7 +279,7 @@ static inline WCHAR *heap_strdupW( const WCHAR *src )
{
WCHAR *dst;
if (!src) return NULL;
- if ((dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
+ if ((dst = malloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
return dst;
}
@@ -290,7 +289,7 @@ static inline WCHAR *heap_strdupAW( const char *src )
WCHAR *dst;
if (!src) return NULL;
len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
- if ((dst = heap_alloc( len * sizeof(*dst) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
+ if ((dst = malloc( len * sizeof(*dst) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
return dst;
}
diff --git a/dlls/wbemprox/wql.y b/dlls/wbemprox/wql.y
index d1b608ac832..637eb6f05fa 100644
--- a/dlls/wbemprox/wql.y
+++ b/dlls/wbemprox/wql.y
@@ -49,7 +49,7 @@ struct string
static void *alloc_mem( struct parser *parser, UINT size )
{
- struct list *mem = heap_alloc( sizeof(struct list) + size );
+ struct list *mem = malloc( sizeof(struct list) + size );
list_add_tail( parser->mem, mem );
return &mem[1];
}
--
2.30.2
More information about the wine-devel
mailing list