Commit a89db318 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Use CRT allocation functions.

parent d8e8ab21
......@@ -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;
......
......@@ -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;
......
......@@ -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++)
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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];
}
......
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