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( ...@@ -61,7 +61,7 @@ static ULONG WINAPI enum_class_object_Release(
{ {
TRACE("destroying %p\n", ec); TRACE("destroying %p\n", ec);
release_query( ec->query ); release_query( ec->query );
heap_free( ec ); free( ec );
} }
return refs; return refs;
} }
...@@ -205,8 +205,7 @@ HRESULT EnumWbemClassObject_create( struct query *query, LPVOID *ppObj ) ...@@ -205,8 +205,7 @@ HRESULT EnumWbemClassObject_create( struct query *query, LPVOID *ppObj )
TRACE("%p\n", ppObj); TRACE("%p\n", ppObj);
ec = heap_alloc( sizeof(*ec) ); if (!(ec = malloc( sizeof(*ec) ))) return E_OUTOFMEMORY;
if (!ec) return E_OUTOFMEMORY;
ec->IEnumWbemClassObject_iface.lpVtbl = &enum_class_object_vtbl; ec->IEnumWbemClassObject_iface.lpVtbl = &enum_class_object_vtbl;
ec->refs = 1; ec->refs = 1;
...@@ -225,10 +224,10 @@ static struct record *create_record( struct table *table ) ...@@ -225,10 +224,10 @@ static struct record *create_record( struct table *table )
UINT i; UINT i;
struct record *record; struct record *record;
if (!(record = heap_alloc( sizeof(struct record) ))) return NULL; if (!(record = malloc( sizeof(struct record) ))) return NULL;
if (!(record->fields = heap_alloc( table->num_cols * sizeof(struct field) ))) if (!(record->fields = malloc( table->num_cols * sizeof(struct field) )))
{ {
heap_free( record ); free( record );
return NULL; return NULL;
} }
for (i = 0; i < table->num_cols; i++) for (i = 0; i < table->num_cols; i++)
...@@ -247,10 +246,10 @@ void destroy_array( struct array *array, CIMTYPE type ) ...@@ -247,10 +246,10 @@ void destroy_array( struct array *array, CIMTYPE type )
if (!array) return; if (!array) return;
if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE) 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 ); free( array->ptr );
heap_free( array ); free( array );
} }
static void destroy_record( struct record *record ) static void destroy_record( struct record *record )
...@@ -263,12 +262,12 @@ 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 || if (record->fields[i].type == CIM_STRING ||
record->fields[i].type == CIM_DATETIME || 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) else if (record->fields[i].type & CIM_FLAG_ARRAY)
destroy_array( record->fields[i].u.aval, record->fields[i].type & CIM_TYPE_MASK ); destroy_array( record->fields[i].u.aval, record->fields[i].type & CIM_TYPE_MASK );
} }
heap_free( record->fields ); free( record->fields );
heap_free( record ); free( record );
} }
struct class_object struct class_object
...@@ -307,8 +306,8 @@ static ULONG WINAPI class_object_Release( ...@@ -307,8 +306,8 @@ static ULONG WINAPI class_object_Release(
TRACE("destroying %p\n", co); TRACE("destroying %p\n", co);
if (co->iter) IEnumWbemClassObject_Release( co->iter ); if (co->iter) IEnumWbemClassObject_Release( co->iter );
destroy_record( co->record ); destroy_record( co->record );
heap_free( co->name ); free( co->name );
heap_free( co ); free( co );
} }
return refs; return refs;
} }
...@@ -774,8 +773,8 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI ...@@ -774,8 +773,8 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
int i = 0; int i = 0;
count = count_instances( iter ); count = count_instances( iter );
if (!(columns = heap_alloc( count * sizeof(struct column) ))) return E_OUTOFMEMORY; if (!(columns = malloc( count * sizeof(struct column) ))) return E_OUTOFMEMORY;
if (!(row = heap_alloc_zero( count * sizeof(LONGLONG) ))) goto error; if (!(row = calloc( count, sizeof(LONGLONG) ))) goto error;
for (;;) for (;;)
{ {
...@@ -805,9 +804,9 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI ...@@ -805,9 +804,9 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
return S_OK; return S_OK;
error: error:
for (; i >= 0; i--) heap_free( (WCHAR *)columns[i].name ); for (; i >= 0; i--) free( (WCHAR *)columns[i].name );
heap_free( columns ); free( columns );
heap_free( row ); free( row );
return hr; return hr;
} }
...@@ -825,7 +824,7 @@ static HRESULT create_signature_table( IEnumWbemClassObject *iter, enum wbm_name ...@@ -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 ))) if (!(table = create_table( name, num_cols, columns, 1, 1, row, NULL )))
{ {
free_columns( columns, num_cols ); free_columns( columns, num_cols );
heap_free( row ); free( row );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if (!add_table( ns, table )) free_table( table ); /* already exists */ 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 ...@@ -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 ); UINT len = ARRAY_SIZE(L"__%s_%s_%s") + ARRAY_SIZE(L"OUT") + lstrlenW( class ) + lstrlenW( method );
WCHAR *ret; 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" ); swprintf( ret, len, L"__%s_%s_%s", class, method, dir == PARAM_IN ? L"IN" : L"OUT" );
return wcsupr( ret ); return wcsupr( ret );
} }
...@@ -852,11 +851,11 @@ HRESULT create_signature( enum wbm_namespace ns, const WCHAR *class, const WCHAR ...@@ -852,11 +851,11 @@ HRESULT create_signature( enum wbm_namespace ns, const WCHAR *class, const WCHAR
HRESULT hr; HRESULT hr;
len += lstrlenW( class ) + lstrlenW( method ); 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" ); swprintf( query, len, selectW, class, method, dir >= 0 ? L">=0" : L"<=0" );
hr = exec_query( ns, query, &iter ); hr = exec_query( ns, query, &iter );
heap_free( query ); free( query );
if (hr != S_OK) return hr; if (hr != S_OK) return hr;
if (!count_instances( iter )) if (!count_instances( iter ))
...@@ -876,7 +875,7 @@ HRESULT create_signature( enum wbm_namespace ns, const WCHAR *class, const WCHAR ...@@ -876,7 +875,7 @@ HRESULT create_signature( enum wbm_namespace ns, const WCHAR *class, const WCHAR
if (hr == S_OK) if (hr == S_OK)
hr = get_object( ns, name, sig ); hr = get_object( ns, name, sig );
heap_free( name ); free( name );
return hr; return hr;
} }
...@@ -1064,15 +1063,14 @@ HRESULT create_class_object( enum wbm_namespace ns, const WCHAR *name, IEnumWbem ...@@ -1064,15 +1063,14 @@ HRESULT create_class_object( enum wbm_namespace ns, const WCHAR *name, IEnumWbem
TRACE("%s, %p\n", debugstr_w(name), obj); TRACE("%s, %p\n", debugstr_w(name), obj);
co = heap_alloc( sizeof(*co) ); if (!(co = malloc( sizeof(*co) ))) return E_OUTOFMEMORY;
if (!co) return E_OUTOFMEMORY;
co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl; co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl;
co->refs = 1; co->refs = 1;
if (!name) co->name = NULL; if (!name) co->name = NULL;
else if (!(co->name = heap_strdupW( name ))) else if (!(co->name = heap_strdupW( name )))
{ {
heap_free( co ); free( co );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
co->iter = iter; co->iter = iter;
......
...@@ -60,9 +60,9 @@ static ULONG WINAPI qualifier_set_Release( ...@@ -60,9 +60,9 @@ static ULONG WINAPI qualifier_set_Release(
if (!refs) if (!refs)
{ {
TRACE("destroying %p\n", set); TRACE("destroying %p\n", set);
heap_free( set->class ); free( set->class );
heap_free( set->member ); free( set->member );
heap_free( set ); free( set );
} }
return refs; return refs;
} }
...@@ -103,24 +103,24 @@ static HRESULT create_qualifier_enum( enum wbm_namespace ns, const WCHAR *class, ...@@ -103,24 +103,24 @@ static HRESULT create_qualifier_enum( enum wbm_namespace ns, const WCHAR *class,
if (member && name) if (member && name)
{ {
len = lstrlenW( class ) + lstrlenW( member ) + lstrlenW( name ) + ARRAY_SIZE(fmtW); 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 ); swprintf( query, len, fmtW, class, member, name );
} }
else if (member) else if (member)
{ {
len = lstrlenW( class ) + lstrlenW( member ) + ARRAY_SIZE(fmt2W); 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 ); swprintf( query, len, fmt2W, class, member );
} }
else else
{ {
len = lstrlenW( class ) + ARRAY_SIZE(fmt3W); 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 ); swprintf( query, len, fmt3W, class );
} }
hr = exec_query( ns, query, iter ); hr = exec_query( ns, query, iter );
heap_free( query ); free( query );
return hr; return hr;
} }
...@@ -279,19 +279,19 @@ HRESULT WbemQualifierSet_create( enum wbm_namespace ns, const WCHAR *class, cons ...@@ -279,19 +279,19 @@ HRESULT WbemQualifierSet_create( enum wbm_namespace ns, const WCHAR *class, cons
TRACE("%p\n", ppObj); 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; set->IWbemQualifierSet_iface.lpVtbl = &qualifier_set_vtbl;
if (!(set->class = heap_strdupW( class ))) if (!(set->class = heap_strdupW( class )))
{ {
heap_free( set ); free( set );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if (!member) set->member = NULL; if (!member) set->member = NULL;
else if (!(set->member = heap_strdupW( member ))) else if (!(set->member = heap_strdupW( member )))
{ {
heap_free( set->class ); free( set->class );
heap_free( set ); free( set );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
set->ns = ns; set->ns = ns;
......
...@@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); ...@@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
static HRESULT append_table( struct view *view, struct table *table ) static HRESULT append_table( struct view *view, struct table *table )
{ {
struct table **tmp; 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 = tmp;
view->table[view->table_count++] = table; view->table[view->table_count++] = table;
return S_OK; return S_OK;
...@@ -41,7 +41,7 @@ static HRESULT append_table( struct view *view, struct table *table ) ...@@ -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, 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 ) 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; if (!view) return E_OUTOFMEMORY;
...@@ -59,7 +59,7 @@ HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *pa ...@@ -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) if (table && (hr = append_table( view, table )) != S_OK)
{ {
heap_free( view ); free( view );
return hr; return hr;
} }
else if (!table && ns == WBEMPROX_NAMESPACE_LAST) return WBEM_E_INVALID_CLASS; 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 ...@@ -69,7 +69,7 @@ HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *pa
} }
default: default:
ERR( "unhandled type %u\n", type ); ERR( "unhandled type %u\n", type );
heap_free( view ); free( view );
return E_INVALIDARG; return E_INVALIDARG;
} }
...@@ -84,9 +84,9 @@ void destroy_view( struct view *view ) ...@@ -84,9 +84,9 @@ void destroy_view( struct view *view )
ULONG i; ULONG i;
if (!view) return; if (!view) return;
for (i = 0; i < view->table_count; i++) release_table( view->table[i] ); for (i = 0; i < view->table_count; i++) release_table( view->table[i] );
heap_free( view->table ); free( view->table );
heap_free( view->result ); free( view->result );
heap_free( view ); free( view );
} }
static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr ) 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 ) ...@@ -477,7 +477,7 @@ static WCHAR *build_assoc_query( const WCHAR *class, UINT class_len )
UINT len = class_len + ARRAY_SIZE(fmtW); UINT len = class_len + ARRAY_SIZE(fmtW);
WCHAR *ret; WCHAR *ret;
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
swprintf( ret, len, fmtW, class ); swprintf( ret, len, fmtW, class );
return ret; return ret;
} }
...@@ -490,7 +490,7 @@ static HRESULT create_assoc_enum( enum wbm_namespace ns, const WCHAR *class, UIN ...@@ -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; if (!(query = build_assoc_query( class, class_len ))) return E_OUTOFMEMORY;
hr = exec_query( ns, query, iter ); hr = exec_query( ns, query, iter );
heap_free( query ); free( query );
return hr; return hr;
} }
...@@ -500,7 +500,7 @@ static WCHAR *build_antecedent_query( const WCHAR *assocclass, const WCHAR *depe ...@@ -500,7 +500,7 @@ static WCHAR *build_antecedent_query( const WCHAR *assocclass, const WCHAR *depe
UINT len = lstrlenW(assocclass) + lstrlenW(dependent) + ARRAY_SIZE(fmtW); UINT len = lstrlenW(assocclass) + lstrlenW(dependent) + ARRAY_SIZE(fmtW);
WCHAR *ret; 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 ); swprintf( ret, len, fmtW, assocclass, dependent );
return ret; return ret;
} }
...@@ -534,7 +534,7 @@ static WCHAR *build_canonical_path( const WCHAR *relpath ) ...@@ -534,7 +534,7 @@ static WCHAR *build_canonical_path( const WCHAR *relpath )
} }
len = ARRAY_SIZE( L"\\\\%s\\%s:" ) + SysStringLen( server ) + SysStringLen( namespace ) + lstrlenW( 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 ); len = swprintf( ret, len, L"\\\\%s\\%s:", server, namespace );
for (i = 0; i < lstrlenW( relpath ); i ++) for (i = 0; i < lstrlenW( relpath ); i ++)
...@@ -577,8 +577,8 @@ static HRESULT get_antecedent( enum wbm_namespace ns, const WCHAR *assocclass, c ...@@ -577,8 +577,8 @@ static HRESULT get_antecedent( enum wbm_namespace ns, const WCHAR *assocclass, c
done: done:
if (iter) IEnumWbemClassObject_Release( iter ); if (iter) IEnumWbemClassObject_Release( iter );
heap_free( str ); free( str );
heap_free( fullpath ); free( fullpath );
return hr; return hr;
} }
...@@ -627,7 +627,7 @@ done: ...@@ -627,7 +627,7 @@ done:
if (query) release_query( query ); if (query) release_query( query );
free_path( path ); free_path( path );
SysFreeString( antecedent ); SysFreeString( antecedent );
heap_free( str ); free( str );
return hr; return hr;
} }
...@@ -671,7 +671,7 @@ static HRESULT exec_assoc_view( struct view *view ) ...@@ -671,7 +671,7 @@ static HRESULT exec_assoc_view( struct view *view )
if (view->table_count) 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; else view->result_count = view->table_count;
} }
...@@ -699,7 +699,7 @@ static HRESULT exec_select_view( struct view *view ) ...@@ -699,7 +699,7 @@ static HRESULT exec_select_view( struct view *view )
if (!table->num_rows) return S_OK; if (!table->num_rows) return S_OK;
len = min( table->num_rows, 16 ); 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++) for (i = 0; i < table->num_rows; i++)
{ {
...@@ -711,7 +711,7 @@ static HRESULT exec_select_view( struct view *view ) ...@@ -711,7 +711,7 @@ static HRESULT exec_select_view( struct view *view )
{ {
UINT *tmp; UINT *tmp;
len *= 2; 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; view->result = tmp;
} }
if (status == FILL_STATUS_FILTERED) val = 1; if (status == FILL_STATUS_FILTERED) val = 1;
...@@ -743,7 +743,7 @@ struct query *create_query( enum wbm_namespace ns ) ...@@ -743,7 +743,7 @@ struct query *create_query( enum wbm_namespace ns )
{ {
struct query *query; struct query *query;
if (!(query = heap_alloc( sizeof(*query) ))) return NULL; if (!(query = malloc( sizeof(*query) ))) return NULL;
list_init( &query->mem ); list_init( &query->mem );
query->ns = ns; query->ns = ns;
query->refs = 1; query->refs = 1;
...@@ -756,8 +756,8 @@ void free_query( struct query *query ) ...@@ -756,8 +756,8 @@ void free_query( struct query *query )
if (!query) return; if (!query) return;
destroy_view( query->view ); destroy_view( query->view );
LIST_FOR_EACH_SAFE( mem, next, &query->mem ) { heap_free( mem ); } LIST_FOR_EACH_SAFE( mem, next, &query->mem ) { free( mem ); }
heap_free( query ); free( query );
} }
struct query *addref_query( struct query *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 ...@@ -811,7 +811,7 @@ static BSTR build_proplist( const struct table *table, UINT row, UINT count, UIN
UINT i, j, offset; UINT i, j, offset;
BSTR *values, ret = NULL; BSTR *values, ret = NULL;
if (!(values = heap_alloc( count * sizeof(BSTR) ))) return NULL; if (!(values = malloc( count * sizeof(BSTR) ))) return NULL;
*len = j = 0; *len = j = 0;
for (i = 0; i < table->num_cols; i++) 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 ...@@ -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] ); for (i = 0; i < count; i++) SysFreeString( values[i] );
heap_free( values ); free( values );
return ret; return ret;
} }
...@@ -1278,13 +1278,13 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type ) ...@@ -1278,13 +1278,13 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type )
if (SafeArrayGetVartype( V_ARRAY( var ), &vartype ) != S_OK) return NULL; if (SafeArrayGetVartype( V_ARRAY( var ), &vartype ) != S_OK) return NULL;
if (!(basetype = to_cimtype( vartype ))) return NULL; if (!(basetype = to_cimtype( vartype ))) return NULL;
if (SafeArrayGetUBound( V_ARRAY( var ), 1, &bound ) != S_OK) 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->count = bound + 1;
ret->elem_size = get_type_size( basetype ); 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; return NULL;
} }
for (i = 0; i < ret->count; i++) for (i = 0; i < ret->count; i++)
......
...@@ -171,11 +171,11 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo ...@@ -171,11 +171,11 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo
TRACE("%p, %s\n", root, debugstr_w(subkey)); 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 ))) if ((res = RegOpenKeyExW( root, subkey, 0, KEY_ENUMERATE_SUB_KEYS | reg_get_access_mask( context ), &hkey )))
{ {
set_variant( VT_UI4, res, NULL, retval ); set_variant( VT_UI4, res, NULL, retval );
heap_free( strings ); free( strings );
return S_OK; return S_OK;
} }
for (;;) for (;;)
...@@ -183,7 +183,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo ...@@ -183,7 +183,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo
if (i >= count) if (i >= count)
{ {
count *= 2; count *= 2;
if (!(tmp = heap_realloc( strings, count * sizeof(BSTR) ))) if (!(tmp = realloc( strings, count * sizeof(BSTR) )))
{ {
RegCloseKey( hkey ); RegCloseKey( hkey );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -211,7 +211,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo ...@@ -211,7 +211,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, IWbemCo
} }
set_variant( VT_UI4, res, NULL, retval ); set_variant( VT_UI4, res, NULL, retval );
RegCloseKey( hkey ); RegCloseKey( hkey );
heap_free( strings ); free( strings );
return hr; return hr;
} }
...@@ -287,9 +287,9 @@ static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARI ...@@ -287,9 +287,9 @@ static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARI
goto done; goto done;
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
if (!(buf = heap_alloc( (buflen + 1) * sizeof(WCHAR) ))) goto done; if (!(buf = malloc( (buflen + 1) * sizeof(WCHAR) ))) goto done;
if (!(value_names = heap_alloc( count * sizeof(BSTR) ))) goto done; if (!(value_names = malloc( count * sizeof(BSTR) ))) goto done;
if (!(value_types = heap_alloc( count * sizeof(DWORD) ))) goto done; if (!(value_types = malloc( count * sizeof(DWORD) ))) goto done;
hr = S_OK; hr = S_OK;
for (;;) for (;;)
...@@ -320,9 +320,9 @@ static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARI ...@@ -320,9 +320,9 @@ static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARI
done: done:
set_variant( VT_UI4, res, NULL, retval ); set_variant( VT_UI4, res, NULL, retval );
RegCloseKey( hkey ); RegCloseKey( hkey );
heap_free( value_names ); free( value_names );
heap_free( value_types ); free( value_types );
heap_free( buf ); free( buf );
return hr; return hr;
} }
......
...@@ -168,7 +168,7 @@ static void free_async( struct async_header *async ) ...@@ -168,7 +168,7 @@ static void free_async( struct async_header *async )
if (async->sink) IWbemObjectSink_Release( async->sink ); if (async->sink) IWbemObjectSink_Release( async->sink );
CloseHandle( async->cancel ); CloseHandle( async->cancel );
CloseHandle( async->wait ); CloseHandle( async->wait );
heap_free( async ); free( async );
} }
static BOOL init_async( struct async_header *async, IWbemObjectSink *sink, static BOOL init_async( struct async_header *async, IWbemObjectSink *sink,
...@@ -247,7 +247,7 @@ static ULONG WINAPI wbem_services_Release( ...@@ -247,7 +247,7 @@ static ULONG WINAPI wbem_services_Release(
DeleteCriticalSection( &ws->cs ); DeleteCriticalSection( &ws->cs );
if (ws->context) if (ws->context)
IWbemContext_Release( ws->context ); IWbemContext_Release( ws->context );
heap_free( ws ); free( ws );
} }
return refs; return refs;
} }
...@@ -342,7 +342,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret ) ...@@ -342,7 +342,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
const WCHAR *p = str, *q; const WCHAR *p = str, *q;
UINT len; UINT len;
if (!(path = heap_alloc_zero( sizeof(*path) ))) return E_OUTOFMEMORY; if (!(path = calloc( 1, sizeof(*path) ))) return E_OUTOFMEMORY;
if (*p == '\\') if (*p == '\\')
{ {
...@@ -353,7 +353,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret ) ...@@ -353,7 +353,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
p++; p++;
if (*p != '\\') if (*p != '\\')
{ {
heap_free( path ); free( path );
return WBEM_E_INVALID_OBJECT_PATH; return WBEM_E_INVALID_OBJECT_PATH;
} }
p++; p++;
...@@ -362,14 +362,14 @@ HRESULT parse_path( const WCHAR *str, struct path **ret ) ...@@ -362,14 +362,14 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*p && *p != '\\') p++; while (*p && *p != '\\') p++;
if (!*p) if (!*p)
{ {
heap_free( path ); free( path );
return WBEM_E_INVALID_OBJECT_PATH; return WBEM_E_INVALID_OBJECT_PATH;
} }
len = p - q; len = p - q;
if (!GetComputerNameW( server, &server_len ) || server_len != len || wcsnicmp( q, server, server_len )) if (!GetComputerNameW( server, &server_len ) || server_len != len || wcsnicmp( q, server, server_len ))
{ {
heap_free( path ); free( path );
return WBEM_E_NOT_SUPPORTED; return WBEM_E_NOT_SUPPORTED;
} }
...@@ -377,14 +377,14 @@ HRESULT parse_path( const WCHAR *str, struct path **ret ) ...@@ -377,14 +377,14 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*p && *p != ':') p++; while (*p && *p != ':') p++;
if (!*p) if (!*p)
{ {
heap_free( path ); free( path );
return WBEM_E_INVALID_OBJECT_PATH; return WBEM_E_INVALID_OBJECT_PATH;
} }
len = p - q; len = p - q;
if (len != ARRAY_SIZE(cimv2W) - 1 || wcsnicmp( q, cimv2W, ARRAY_SIZE(cimv2W) - 1 )) if (len != ARRAY_SIZE(cimv2W) - 1 || wcsnicmp( q, cimv2W, ARRAY_SIZE(cimv2W) - 1 ))
{ {
heap_free( path ); free( path );
return WBEM_E_INVALID_NAMESPACE; return WBEM_E_INVALID_NAMESPACE;
} }
p++; p++;
...@@ -394,9 +394,9 @@ HRESULT parse_path( const WCHAR *str, struct path **ret ) ...@@ -394,9 +394,9 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*p && *p != '.') p++; while (*p && *p != '.') p++;
len = p - q; 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; return E_OUTOFMEMORY;
} }
memcpy( path->class, q, len * sizeof(WCHAR) ); memcpy( path->class, q, len * sizeof(WCHAR) );
...@@ -409,10 +409,10 @@ HRESULT parse_path( const WCHAR *str, struct path **ret ) ...@@ -409,10 +409,10 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
while (*q) q++; while (*q) q++;
len = q - p; len = q - p;
if (!(path->filter = heap_alloc( (len + 1) * sizeof(WCHAR) ))) if (!(path->filter = malloc( (len + 1) * sizeof(WCHAR) )))
{ {
heap_free( path->class ); free( path->class );
heap_free( path ); free( path );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
memcpy( path->filter, p, len * sizeof(WCHAR) ); memcpy( path->filter, p, len * sizeof(WCHAR) );
...@@ -426,9 +426,9 @@ HRESULT parse_path( const WCHAR *str, struct path **ret ) ...@@ -426,9 +426,9 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
void free_path( struct path *path ) void free_path( struct path *path )
{ {
if (!path) return; if (!path) return;
heap_free( path->class ); free( path->class );
heap_free( path->filter ); free( path->filter );
heap_free( path ); free( path );
} }
WCHAR *query_from_path( const struct path *path ) WCHAR *query_from_path( const struct path *path )
...@@ -441,13 +441,13 @@ WCHAR *query_from_path( const struct path *path ) ...@@ -441,13 +441,13 @@ WCHAR *query_from_path( const struct path *path )
if (path->filter) if (path->filter)
{ {
len = path->class_len + path->filter_len + ARRAY_SIZE(selectW); 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 ); swprintf( query, len, selectW, path->class, path->filter );
} }
else else
{ {
len = path->class_len + ARRAY_SIZE(select_allW); 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 ); lstrcpyW( query, select_allW );
lstrcatW( query, path->class ); lstrcatW( query, path->class );
} }
...@@ -461,7 +461,7 @@ static HRESULT create_instance_enum( enum wbm_namespace ns, const struct path *p ...@@ -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; if (!(query = query_from_path( path ))) return E_OUTOFMEMORY;
hr = exec_query( ns, query, iter ); hr = exec_query( ns, query, iter );
heap_free( query ); free( query );
return hr; return hr;
} }
...@@ -707,7 +707,7 @@ static void async_exec_query( struct async_header *hdr ) ...@@ -707,7 +707,7 @@ static void async_exec_query( struct async_header *hdr )
IEnumWbemClassObject_Release( result ); IEnumWbemClassObject_Release( result );
} }
IWbemObjectSink_SetStatus( query->hdr.sink, WBEM_STATUS_COMPLETE, hr, NULL, NULL ); IWbemObjectSink_SetStatus( query->hdr.sink, WBEM_STATUS_COMPLETE, hr, NULL, NULL );
heap_free( query->str ); free( query->str );
} }
static HRESULT WINAPI wbem_services_ExecQueryAsync( static HRESULT WINAPI wbem_services_ExecQueryAsync(
...@@ -740,7 +740,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync( ...@@ -740,7 +740,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync(
hr = WBEM_E_FAILED; hr = WBEM_E_FAILED;
goto done; goto done;
} }
if (!(query = heap_alloc_zero( sizeof(*query) ))) goto done; if (!(query = calloc( 1, sizeof(*query) ))) goto done;
query->ns = services->ns; query->ns = services->ns;
async = (struct async_header *)query; async = (struct async_header *)query;
...@@ -758,7 +758,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync( ...@@ -758,7 +758,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync(
if (hr == S_OK) services->async = async; if (hr == S_OK) services->async = async;
else else
{ {
heap_free( query->str ); free( query->str );
free_async( async ); free_async( async );
} }
...@@ -810,7 +810,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync( ...@@ -810,7 +810,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync(
hr = WBEM_E_FAILED; hr = WBEM_E_FAILED;
goto done; goto done;
} }
if (!(query = heap_alloc_zero( sizeof(*query) ))) goto done; if (!(query = calloc( 1, sizeof(*query) ))) goto done;
async = (struct async_header *)query; async = (struct async_header *)query;
if (!(init_async( async, sink, async_exec_query ))) if (!(init_async( async, sink, async_exec_query )))
...@@ -827,7 +827,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync( ...@@ -827,7 +827,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync(
if (hr == S_OK) services->async = async; if (hr == S_OK) services->async = async;
else else
{ {
heap_free( query->str ); free( query->str );
free_async( async ); free_async( async );
} }
...@@ -896,7 +896,7 @@ done: ...@@ -896,7 +896,7 @@ done:
if (obj) IWbemClassObject_Release( obj ); if (obj) IWbemClassObject_Release( obj );
free_query( query ); free_query( query );
free_path( path ); free_path( path );
heap_free( str ); free( str );
return hr; return hr;
} }
...@@ -955,8 +955,7 @@ HRESULT WbemServices_create( const WCHAR *namespace, IWbemContext *context, LPVO ...@@ -955,8 +955,7 @@ HRESULT WbemServices_create( const WCHAR *namespace, IWbemContext *context, LPVO
else if ((ns = get_namespace_from_string( namespace )) == WBEMPROX_NAMESPACE_LAST) else if ((ns = get_namespace_from_string( namespace )) == WBEMPROX_NAMESPACE_LAST)
return WBEM_E_INVALID_NAMESPACE; return WBEM_E_INVALID_NAMESPACE;
ws = heap_alloc_zero( sizeof(*ws) ); if (!(ws = calloc( 1, sizeof(*ws) ))) return E_OUTOFMEMORY;
if (!ws) return E_OUTOFMEMORY;
ws->IWbemServices_iface.lpVtbl = &wbem_services_vtbl; ws->IWbemServices_iface.lpVtbl = &wbem_services_vtbl;
ws->refs = 1; ws->refs = 1;
...@@ -994,8 +993,8 @@ static void wbem_context_delete_values(struct wbem_context *context) ...@@ -994,8 +993,8 @@ static void wbem_context_delete_values(struct wbem_context *context)
{ {
list_remove( &value->entry ); list_remove( &value->entry );
VariantClear( &value->value ); VariantClear( &value->value );
heap_free( value->name ); free( value->name );
heap_free( value ); free( value );
} }
} }
...@@ -1043,7 +1042,7 @@ static ULONG WINAPI wbem_context_Release( ...@@ -1043,7 +1042,7 @@ static ULONG WINAPI wbem_context_Release(
{ {
TRACE("destroying %p\n", context); TRACE("destroying %p\n", context);
wbem_context_delete_values( context ); wbem_context_delete_values( context );
heap_free( context ); free( context );
} }
return refs; return refs;
} }
...@@ -1152,16 +1151,16 @@ static HRESULT WINAPI wbem_context_SetValue( ...@@ -1152,16 +1151,16 @@ static HRESULT WINAPI wbem_context_SetValue(
} }
else 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 ))) if (!(value->name = heap_strdupW( name )))
{ {
heap_free( value ); free( value );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if (FAILED(hr = VariantCopy( &value->value, var ))) if (FAILED(hr = VariantCopy( &value->value, var )))
{ {
heap_free( value->name ); free( value->name );
heap_free( value ); free( value );
return hr; return hr;
} }
...@@ -1232,8 +1231,7 @@ HRESULT WbemContext_create( void **obj ) ...@@ -1232,8 +1231,7 @@ HRESULT WbemContext_create( void **obj )
TRACE("(%p)\n", obj); TRACE("(%p)\n", obj);
context = heap_alloc( sizeof(*context) ); if (!(context = malloc( sizeof(*context) ))) return E_OUTOFMEMORY;
if (!context) return E_OUTOFMEMORY;
context->IWbemContext_iface.lpVtbl = &wbem_context_vtbl; context->IWbemContext_iface.lpVtbl = &wbem_context_vtbl;
context->refs = 1; context->refs = 1;
......
...@@ -291,7 +291,7 @@ void free_row_values( const struct table *table, UINT row ) ...@@ -291,7 +291,7 @@ void free_row_values( const struct table *table, UINT row )
type = table->columns[i].type & COL_TYPE_MASK; type = table->columns[i].type & COL_TYPE_MASK;
if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE) 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) else if (type & CIM_FLAG_ARRAY)
{ {
...@@ -312,7 +312,7 @@ void clear_table( struct table *table ) ...@@ -312,7 +312,7 @@ void clear_table( struct table *table )
{ {
table->num_rows = 0; table->num_rows = 0;
table->num_rows_allocated = 0; table->num_rows_allocated = 0;
heap_free( table->data ); free( table->data );
table->data = NULL; table->data = NULL;
} }
} }
...@@ -321,8 +321,8 @@ void free_columns( struct column *columns, UINT num_cols ) ...@@ -321,8 +321,8 @@ void free_columns( struct column *columns, UINT num_cols )
{ {
UINT i; UINT i;
for (i = 0; i < num_cols; i++) { heap_free( (WCHAR *)columns[i].name ); } for (i = 0; i < num_cols; i++) { free( (WCHAR *)columns[i].name ); }
heap_free( columns ); free( columns );
} }
void free_table( struct table *table ) void free_table( struct table *table )
...@@ -333,11 +333,11 @@ void free_table( struct table *table ) ...@@ -333,11 +333,11 @@ void free_table( struct table *table )
if (table->flags & TABLE_FLAG_DYNAMIC) if (table->flags & TABLE_FLAG_DYNAMIC)
{ {
TRACE("destroying %p\n", table); TRACE("destroying %p\n", table);
heap_free( (WCHAR *)table->name ); free( (WCHAR *)table->name );
free_columns( (struct column *)table->columns, table->num_cols ); free_columns( (struct column *)table->columns, table->num_cols );
heap_free( table->data ); free( table->data );
list_remove( &table->entry ); 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 ...@@ -375,7 +375,7 @@ struct table *create_table( const WCHAR *name, UINT num_cols, const struct colum
{ {
struct table *table; struct table *table;
if (!(table = heap_alloc( sizeof(*table) ))) return NULL; if (!(table = malloc( sizeof(*table) ))) return NULL;
table->name = heap_strdupW( name ); table->name = heap_strdupW( name );
table->num_cols = num_cols; table->num_cols = num_cols;
table->columns = columns; table->columns = columns;
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "initguid.h" #include "initguid.h"
#include "objidl.h" #include "objidl.h"
#include "wbemcli.h" #include "wbemcli.h"
#include "wine/heap.h"
#include "wine/test.h" #include "wine/test.h"
static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemClassObject **result ) static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemClassObject **result )
...@@ -195,7 +194,7 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services ) ...@@ -195,7 +194,7 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services )
hr = IEnumWbemClassObject_Reset( result ); hr = IEnumWbemClassObject_Reset( result );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
obj = heap_alloc( num_objects * sizeof( IWbemClassObject * ) ); obj = malloc( num_objects * sizeof( IWbemClassObject * ) );
count = 0; count = 0;
hr = IEnumWbemClassObject_Next( result, 10000, num_objects, obj, &count ); hr = IEnumWbemClassObject_Next( result, 10000, num_objects, obj, &count );
...@@ -216,7 +215,7 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services ) ...@@ -216,7 +215,7 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services )
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
IWbemClassObject_Release( obj[i] ); IWbemClassObject_Release( obj[i] );
heap_free( obj ); free( obj );
IEnumWbemClassObject_Release( result ); IEnumWbemClassObject_Release( result );
SysFreeString( query ); SysFreeString( query );
......
...@@ -56,7 +56,7 @@ static ULONG WINAPI wbem_locator_Release( ...@@ -56,7 +56,7 @@ static ULONG WINAPI wbem_locator_Release(
if (!refs) if (!refs)
{ {
TRACE("destroying %p\n", wl); TRACE("destroying %p\n", wl);
heap_free( wl ); free( wl );
} }
return refs; return refs;
} }
...@@ -113,7 +113,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na ...@@ -113,7 +113,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
while (*q && *q != '\\' && *q != '/') q++; while (*q && *q != '\\' && *q != '/') q++;
if (!*q) return WBEM_E_INVALID_NAMESPACE; if (!*q) return WBEM_E_INVALID_NAMESPACE;
len = q - p; len = q - p;
if (!(*server = heap_alloc( (len + 1) * sizeof(WCHAR) ))) if (!(*server = malloc( (len + 1) * sizeof(WCHAR) )))
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto done; goto done;
...@@ -134,7 +134,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na ...@@ -134,7 +134,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
} }
q++; q++;
len = lstrlenW( 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 else
{ {
memcpy( *namespace, q, len * sizeof(WCHAR) ); memcpy( *namespace, q, len * sizeof(WCHAR) );
...@@ -145,8 +145,8 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na ...@@ -145,8 +145,8 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
done: done:
if (hr != S_OK) if (hr != S_OK)
{ {
heap_free( *server ); free( *server );
heap_free( *namespace ); free( *namespace );
} }
return hr; return hr;
} }
...@@ -174,8 +174,8 @@ static HRESULT WINAPI wbem_locator_ConnectServer( ...@@ -174,8 +174,8 @@ static HRESULT WINAPI wbem_locator_ConnectServer(
if (!is_local_machine( server )) if (!is_local_machine( server ))
{ {
FIXME("remote computer not supported\n"); FIXME("remote computer not supported\n");
heap_free( server ); free( server );
heap_free( namespace ); free( namespace );
return WBEM_E_TRANSPORT_FAILURE; return WBEM_E_TRANSPORT_FAILURE;
} }
if (User || Password || Authority) if (User || Password || Authority)
...@@ -186,8 +186,8 @@ static HRESULT WINAPI wbem_locator_ConnectServer( ...@@ -186,8 +186,8 @@ static HRESULT WINAPI wbem_locator_ConnectServer(
FIXME("unsupported flags\n"); FIXME("unsupported flags\n");
hr = WbemServices_create( namespace, context, (void **)ppNamespace ); hr = WbemServices_create( namespace, context, (void **)ppNamespace );
heap_free( namespace ); free( namespace );
heap_free( server ); free( server );
if (SUCCEEDED( hr )) if (SUCCEEDED( hr ))
return WBEM_NO_ERROR; return WBEM_NO_ERROR;
...@@ -208,8 +208,7 @@ HRESULT WbemLocator_create( LPVOID *ppObj ) ...@@ -208,8 +208,7 @@ HRESULT WbemLocator_create( LPVOID *ppObj )
TRACE("(%p)\n", ppObj); TRACE("(%p)\n", ppObj);
wl = heap_alloc( sizeof(*wl) ); if (!(wl = malloc( sizeof(*wl) ))) return E_OUTOFMEMORY;
if (!wl) return E_OUTOFMEMORY;
wl->IWbemLocator_iface.lpVtbl = &wbem_locator_vtbl; wl->IWbemLocator_iface.lpVtbl = &wbem_locator_vtbl;
wl->refs = 1; wl->refs = 1;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
*/ */
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
enum wbm_namespace enum wbm_namespace
...@@ -280,7 +279,7 @@ static inline WCHAR *heap_strdupW( const WCHAR *src ) ...@@ -280,7 +279,7 @@ static inline WCHAR *heap_strdupW( const WCHAR *src )
{ {
WCHAR *dst; WCHAR *dst;
if (!src) return NULL; 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; return dst;
} }
...@@ -290,7 +289,7 @@ static inline WCHAR *heap_strdupAW( const char *src ) ...@@ -290,7 +289,7 @@ static inline WCHAR *heap_strdupAW( const char *src )
WCHAR *dst; WCHAR *dst;
if (!src) return NULL; if (!src) return NULL;
len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 ); 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; return dst;
} }
......
...@@ -49,7 +49,7 @@ struct string ...@@ -49,7 +49,7 @@ struct string
static void *alloc_mem( struct parser *parser, UINT size ) 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 ); list_add_tail( parser->mem, mem );
return &mem[1]; 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