Commit d920aa81 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

msi: Remove wrappers around CRT memory allocation functions.

parent e5b6dce9
...@@ -129,7 +129,7 @@ static UINT ALTER_delete( struct tagMSIVIEW *view ) ...@@ -129,7 +129,7 @@ static UINT ALTER_delete( struct tagMSIVIEW *view )
TRACE("%p\n", av ); TRACE("%p\n", av );
if (av->table) if (av->table)
av->table->ops->delete( av->table ); av->table->ops->delete( av->table );
msi_free( av ); free( av );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -164,14 +164,14 @@ UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_inf ...@@ -164,14 +164,14 @@ UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_inf
TRACE("%p %p %s %d\n", view, colinfo, debugstr_w(name), hold ); TRACE("%p %p %s %d\n", view, colinfo, debugstr_w(name), hold );
av = msi_alloc_zero( sizeof *av ); av = calloc( 1, sizeof *av );
if( !av ) if( !av )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
r = TABLE_CreateView( db, name, &av->table ); r = TABLE_CreateView( db, name, &av->table );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
msi_free( av ); free( av );
return r; return r;
} }
......
...@@ -109,13 +109,13 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR * ...@@ -109,13 +109,13 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *
if (minVersion) if (minVersion)
{ {
msi_parse_version_string( minVersion, &sig->MinVersionMS, &sig->MinVersionLS ); msi_parse_version_string( minVersion, &sig->MinVersionMS, &sig->MinVersionLS );
msi_free( minVersion ); free( minVersion );
} }
maxVersion = msi_dup_record_field(row,4); maxVersion = msi_dup_record_field(row,4);
if (maxVersion) if (maxVersion)
{ {
msi_parse_version_string( maxVersion, &sig->MaxVersionMS, &sig->MaxVersionLS ); msi_parse_version_string( maxVersion, &sig->MaxVersionMS, &sig->MaxVersionLS );
msi_free( maxVersion ); free( maxVersion );
} }
sig->MinSize = MSI_RecordGetInteger(row,5); sig->MinSize = MSI_RecordGetInteger(row,5);
if (sig->MinSize == MSI_NULL_INTEGER) if (sig->MinSize == MSI_NULL_INTEGER)
...@@ -150,8 +150,8 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR * ...@@ -150,8 +150,8 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *
/* Frees any memory allocated in sig */ /* Frees any memory allocated in sig */
static void free_signature( MSISIGNATURE *sig ) static void free_signature( MSISIGNATURE *sig )
{ {
msi_free(sig->File); free(sig->File);
msi_free(sig->Languages); free(sig->Languages);
} }
static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
...@@ -182,7 +182,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) ...@@ -182,7 +182,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
if (!size) if (!size)
return wcsdup(path); return wcsdup(path);
buffer = msi_alloc(size); buffer = malloc(size);
if (!buffer) if (!buffer)
return NULL; return NULL;
...@@ -216,7 +216,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) ...@@ -216,7 +216,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
val = wcsdup(path); val = wcsdup(path);
done: done:
msi_free(buffer); free(buffer);
return val; return val;
} }
...@@ -305,13 +305,13 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR ...@@ -305,13 +305,13 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR
if (*(LPCWSTR)value == '#') if (*(LPCWSTR)value == '#')
{ {
/* escape leading pound with another */ /* escape leading pound with another */
*appValue = msi_alloc(sz + sizeof(WCHAR)); *appValue = malloc(sz + sizeof(WCHAR));
(*appValue)[0] = '#'; (*appValue)[0] = '#';
lstrcpyW(*appValue + 1, (LPCWSTR)value); lstrcpyW(*appValue + 1, (LPCWSTR)value);
} }
else else
{ {
*appValue = msi_alloc(sz); *appValue = malloc(sz);
lstrcpyW(*appValue, (LPCWSTR)value); lstrcpyW(*appValue, (LPCWSTR)value);
} }
break; break;
...@@ -319,17 +319,17 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR ...@@ -319,17 +319,17 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR
/* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign /* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign
* char if needed * char if needed
*/ */
*appValue = msi_alloc(10 * sizeof(WCHAR)); *appValue = malloc(10 * sizeof(WCHAR));
swprintf(*appValue, 10, L"#%d", *(const DWORD *)value); swprintf(*appValue, 10, L"#%d", *(const DWORD *)value);
break; break;
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0); sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0);
*appValue = msi_alloc(sz * sizeof(WCHAR)); *appValue = malloc(sz * sizeof(WCHAR));
ExpandEnvironmentStringsW((LPCWSTR)value, *appValue, sz); ExpandEnvironmentStringsW((LPCWSTR)value, *appValue, sz);
break; break;
case REG_BINARY: case REG_BINARY:
/* #x<nibbles>\0 */ /* #x<nibbles>\0 */
*appValue = msi_alloc((sz * 2 + 3) * sizeof(WCHAR)); *appValue = malloc((sz * 2 + 3) * sizeof(WCHAR));
lstrcpyW(*appValue, L"#x"); lstrcpyW(*appValue, L"#x");
ptr = *appValue + lstrlenW(L"#x"); ptr = *appValue + lstrlenW(L"#x");
for (i = 0; i < sz; i++, ptr += 2) for (i = 0; i < sz; i++, ptr += 2)
...@@ -401,7 +401,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ...@@ -401,7 +401,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig
goto end; goto end;
} }
msi_free(deformatted); free(deformatted);
deformat_string(package, valueName, &deformatted); deformat_string(package, valueName, &deformatted);
rc = RegQueryValueExW(key, deformatted, NULL, NULL, NULL, &sz); rc = RegQueryValueExW(key, deformatted, NULL, NULL, NULL, &sz);
...@@ -413,7 +413,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ...@@ -413,7 +413,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig
/* FIXME: sanity-check sz before allocating (is there an upper-limit /* FIXME: sanity-check sz before allocating (is there an upper-limit
* on the value of a property?) * on the value of a property?)
*/ */
value = msi_alloc( sz ); value = malloc(sz);
rc = RegQueryValueExW(key, deformatted, NULL, &regType, value, &sz); rc = RegQueryValueExW(key, deformatted, NULL, &regType, value, &sz);
if (rc) if (rc)
{ {
...@@ -431,9 +431,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ...@@ -431,9 +431,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig
sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0); sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0);
if (sz) if (sz)
{ {
LPWSTR buf = msi_alloc(sz * sizeof(WCHAR)); WCHAR *buf = malloc(sz * sizeof(WCHAR));
ExpandEnvironmentStringsW((LPCWSTR)value, buf, sz); ExpandEnvironmentStringsW((LPCWSTR)value, buf, sz);
msi_free(value); free(value);
value = (LPBYTE)buf; value = (LPBYTE)buf;
} }
} }
...@@ -460,9 +460,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ...@@ -460,9 +460,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig
type, debugstr_w(keyPath), debugstr_w(valueName)); type, debugstr_w(keyPath), debugstr_w(valueName));
} }
end: end:
msi_free( value ); free( value );
RegCloseKey( key ); RegCloseKey( key );
msi_free( deformatted ); free( deformatted );
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -539,9 +539,9 @@ static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ...@@ -539,9 +539,9 @@ static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig
} }
} }
msi_free(fileName); free(fileName);
msi_free(section); free(section);
msi_free(key); free(key);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
...@@ -578,13 +578,13 @@ static void expand_any_path( MSIPACKAGE *package, WCHAR *src, WCHAR *dst, size_t ...@@ -578,13 +578,13 @@ static void expand_any_path( MSIPACKAGE *package, WCHAR *src, WCHAR *dst, size_t
deformat_string(package, ptr, &deformatted); deformat_string(package, ptr, &deformatted);
if (!deformatted || lstrlenW(deformatted) > len - 1) if (!deformatted || lstrlenW(deformatted) > len - 1)
{ {
msi_free(deformatted); free(deformatted);
return; return;
} }
lstrcpyW(dst, deformatted); lstrcpyW(dst, deformatted);
dst[lstrlenW(deformatted)] = '\0'; dst[lstrlenW(deformatted)] = '\0';
msi_free(deformatted); free(deformatted);
} }
static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids ) static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids )
...@@ -596,9 +596,9 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids ) ...@@ -596,9 +596,9 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids )
if (!str) return NULL; if (!str) return NULL;
for (p = q = str; (q = wcschr( q, ',' )); q++) count++; for (p = q = str; (q = wcschr( q, ',' )); q++) count++;
if (!(ret = msi_alloc( count * sizeof(LANGID) ))) if (!(ret = malloc( count * sizeof(LANGID) )))
{ {
msi_free( str ); free( str );
return NULL; return NULL;
} }
i = 0; i = 0;
...@@ -611,7 +611,7 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids ) ...@@ -611,7 +611,7 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids )
p = q + 1; p = q + 1;
i++; i++;
} }
msi_free( str ); free( str );
*num_ids = count; *num_ids = count;
return ret; return ret;
} }
...@@ -643,7 +643,7 @@ static BOOL match_languages( const void *version, const WCHAR *languages ) ...@@ -643,7 +643,7 @@ static BOOL match_languages( const void *version, const WCHAR *languages )
} }
done: done:
msi_free( ids ); free( ids );
return found; return found;
} }
...@@ -663,7 +663,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, ...@@ -663,7 +663,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig,
*matches = FALSE; *matches = FALSE;
if (!size) return ERROR_SUCCESS; if (!size) return ERROR_SUCCESS;
if (!(version = msi_alloc( size ))) return ERROR_OUTOFMEMORY; if (!(version = malloc( size ))) return ERROR_OUTOFMEMORY;
if (msi_get_file_version_info( package, filePath, size, version )) if (msi_get_file_version_info( package, filePath, size, version ))
VerQueryValueW( version, L"\\", (void **)&info, &len ); VerQueryValueW( version, L"\\", (void **)&info, &len );
...@@ -702,7 +702,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, ...@@ -702,7 +702,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig,
} }
else *matches = TRUE; else *matches = TRUE;
} }
msi_free( version ); free( version );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -779,7 +779,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI ...@@ -779,7 +779,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI
* isn't backslash-terminated. * isn't backslash-terminated.
*/ */
len = dirLen + max(fileLen, lstrlenW(L"*.*")) + 2; len = dirLen + max(fileLen, lstrlenW(L"*.*")) + 2;
buf = msi_alloc(len * sizeof(WCHAR)); buf = malloc(len * sizeof(WCHAR));
if (!buf) if (!buf)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
...@@ -839,7 +839,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI ...@@ -839,7 +839,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI
} }
if (*appValue != buf) if (*appValue != buf)
msi_free(buf); free(buf);
return rc; return rc;
} }
...@@ -920,7 +920,7 @@ static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHA ...@@ -920,7 +920,7 @@ static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHA
if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) && if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) &&
val && val[lstrlenW(val) - 1] != '\\') val && val[lstrlenW(val) - 1] != '\\')
{ {
val = msi_realloc(val, (lstrlenW(val) + 2) * sizeof(WCHAR)); val = realloc(val, (wcslen(val) + 2) * sizeof(WCHAR));
if (!val) if (!val)
rc = ERROR_OUTOFMEMORY; rc = ERROR_OUTOFMEMORY;
else else
...@@ -1004,7 +1004,7 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ...@@ -1004,7 +1004,7 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig
rc = search_directory( package, sig, path, depth, appValue ); rc = search_directory( package, sig, path, depth, appValue );
msi_free(parent); free(parent);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
TRACE("returning %d\n", rc); TRACE("returning %d\n", rc);
return rc; return rc;
...@@ -1055,7 +1055,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param) ...@@ -1055,7 +1055,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param)
if (r == ERROR_SUCCESS && !wcscmp( propName, L"SourceDir" )) if (r == ERROR_SUCCESS && !wcscmp( propName, L"SourceDir" ))
msi_reset_source_folders( package ); msi_reset_source_folders( package );
msi_free(value); free(value);
} }
free_signature( &sig ); free_signature( &sig );
...@@ -1107,7 +1107,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param) ...@@ -1107,7 +1107,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
{ {
TRACE("Found signature %s\n", debugstr_w(signature)); TRACE("Found signature %s\n", debugstr_w(signature));
msi_set_property( package->db, L"CCP_Success", L"1", -1 ); msi_set_property( package->db, L"CCP_Success", L"1", -1 );
msi_free(value); free(value);
r = ERROR_NO_MORE_ITEMS; r = ERROR_NO_MORE_ITEMS;
} }
......
...@@ -164,7 +164,7 @@ static UINT get_assembly_name_attribute( MSIRECORD *rec, LPVOID param ) ...@@ -164,7 +164,7 @@ static UINT get_assembly_name_attribute( MSIRECORD *rec, LPVOID param )
const WCHAR *value = MSI_RecordGetString( rec, 3 ); const WCHAR *value = MSI_RecordGetString( rec, 3 );
int len = lstrlenW( L"%s=\"%s\"" ) + lstrlenW( attr ) + lstrlenW( value ); int len = lstrlenW( L"%s=\"%s\"" ) + lstrlenW( attr ) + lstrlenW( value );
if (!(name->attrs[name->index] = msi_alloc( len * sizeof(WCHAR) ))) if (!(name->attrs[name->index] = malloc( len * sizeof(WCHAR) )))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
if (!wcsicmp( attr, L"name" )) lstrcpyW( name->attrs[name->index++], value ); if (!wcsicmp( attr, L"name" )) lstrcpyW( name->attrs[name->index++], value );
...@@ -190,7 +190,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI ...@@ -190,7 +190,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI
MSI_IterateRecords( view, &name.count, NULL, NULL ); MSI_IterateRecords( view, &name.count, NULL, NULL );
if (!name.count) goto done; if (!name.count) goto done;
name.attrs = msi_alloc( name.count * sizeof(WCHAR *) ); name.attrs = malloc( name.count * sizeof(WCHAR *) );
if (!name.attrs) goto done; if (!name.attrs) goto done;
MSI_IterateRecords( view, NULL, get_assembly_name_attribute, &name ); MSI_IterateRecords( view, NULL, get_assembly_name_attribute, &name );
...@@ -198,7 +198,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI ...@@ -198,7 +198,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI
len = 0; len = 0;
for (i = 0; i < name.count; i++) len += lstrlenW( name.attrs[i] ) + 1; for (i = 0; i < name.count; i++) len += lstrlenW( name.attrs[i] ) + 1;
display_name = msi_alloc( (len + 1) * sizeof(WCHAR) ); display_name = malloc( (len + 1) * sizeof(WCHAR) );
if (display_name) if (display_name)
{ {
display_name[0] = 0; display_name[0] = 0;
...@@ -213,8 +213,8 @@ done: ...@@ -213,8 +213,8 @@ done:
msiobj_release( &view->hdr ); msiobj_release( &view->hdr );
if (name.attrs) if (name.attrs)
{ {
for (i = 0; i < name.count; i++) msi_free( name.attrs[i] ); for (i = 0; i < name.count; i++) free( name.attrs[i] );
msi_free( name.attrs ); free( name.attrs );
} }
return display_name; return display_name;
} }
...@@ -250,12 +250,12 @@ WCHAR *msi_get_assembly_path( MSIPACKAGE *package, const WCHAR *displayname ) ...@@ -250,12 +250,12 @@ WCHAR *msi_get_assembly_path( MSIPACKAGE *package, const WCHAR *displayname )
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info ); hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info );
if (hr != E_NOT_SUFFICIENT_BUFFER) return NULL; if (hr != E_NOT_SUFFICIENT_BUFFER) return NULL;
if (!(info.pszCurrentAssemblyPathBuf = msi_alloc( info.cchBuf * sizeof(WCHAR) ))) return NULL; if (!(info.pszCurrentAssemblyPathBuf = malloc( info.cchBuf * sizeof(WCHAR) ))) return NULL;
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info ); hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info );
if (FAILED( hr )) if (FAILED( hr ))
{ {
msi_free( info.pszCurrentAssemblyPathBuf ); free( info.pszCurrentAssemblyPathBuf );
return NULL; return NULL;
} }
TRACE("returning %s\n", debugstr_w(info.pszCurrentAssemblyPathBuf)); TRACE("returning %s\n", debugstr_w(info.pszCurrentAssemblyPathBuf));
...@@ -276,7 +276,7 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const WCHAR *displ ...@@ -276,7 +276,7 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const WCHAR *displ
if (FAILED( hr )) return NULL; if (FAILED( hr )) return NULL;
hr = IAssemblyName_GetName( name, &len, NULL ); hr = IAssemblyName_GetName( name, &len, NULL );
if (hr != E_NOT_SUFFICIENT_BUFFER || !(str = msi_alloc( len * sizeof(WCHAR) ))) if (hr != E_NOT_SUFFICIENT_BUFFER || !(str = malloc( len * sizeof(WCHAR) )))
{ {
IAssemblyName_Release( name ); IAssemblyName_Release( name );
return NULL; return NULL;
...@@ -286,12 +286,12 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const WCHAR *displ ...@@ -286,12 +286,12 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const WCHAR *displ
IAssemblyName_Release( name ); IAssemblyName_Release( name );
if (FAILED( hr )) if (FAILED( hr ))
{ {
msi_free( str ); free( str );
return NULL; return NULL;
} }
hr = package->pCreateAssemblyNameObject( &name, str, 0, NULL ); hr = package->pCreateAssemblyNameObject( &name, str, 0, NULL );
msi_free( str ); free( str );
if (FAILED( hr )) return NULL; if (FAILED( hr )) return NULL;
hr = package->pCreateAssemblyEnum( &ret, NULL, name, ASM_CACHE_GAC, NULL ); hr = package->pCreateAssemblyEnum( &ret, NULL, name, ASM_CACHE_GAC, NULL );
...@@ -322,7 +322,7 @@ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) ...@@ -322,7 +322,7 @@ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
MSIASSEMBLY *a; MSIASSEMBLY *a;
if (!(rec = get_assembly_record( package, comp->Component ))) return NULL; if (!(rec = get_assembly_record( package, comp->Component ))) return NULL;
if (!(a = msi_alloc_zero( sizeof(MSIASSEMBLY) ))) if (!(a = calloc( 1, sizeof(MSIASSEMBLY) )))
{ {
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
return NULL; return NULL;
...@@ -343,10 +343,10 @@ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) ...@@ -343,10 +343,10 @@ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
{ {
WARN("can't get display name\n"); WARN("can't get display name\n");
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
msi_free( a->feature ); free( a->feature );
msi_free( a->manifest ); free( a->manifest );
msi_free( a->application ); free( a->application );
msi_free( a ); free( a );
return NULL; return NULL;
} }
TRACE("display name %s\n", debugstr_w(a->display_name)); TRACE("display name %s\n", debugstr_w(a->display_name));
...@@ -394,7 +394,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const WCHAR *filen ...@@ -394,7 +394,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const WCHAR *filen
hr = package->pGetFileVersion( filename, NULL, 0, &len ); hr = package->pGetFileVersion( filename, NULL, 0, &len );
if (hr != E_NOT_SUFFICIENT_BUFFER) return CLR_VERSION_V11; if (hr != E_NOT_SUFFICIENT_BUFFER) return CLR_VERSION_V11;
if ((strW = msi_alloc( len * sizeof(WCHAR) ))) if ((strW = malloc( len * sizeof(WCHAR) )))
{ {
hr = package->pGetFileVersion( filename, strW, len, &len ); hr = package->pGetFileVersion( filename, strW, len, &len );
if (hr == S_OK) if (hr == S_OK)
...@@ -403,7 +403,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const WCHAR *filen ...@@ -403,7 +403,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const WCHAR *filen
for (i = 0; i < CLR_VERSION_MAX; i++) for (i = 0; i < CLR_VERSION_MAX; i++)
if (!wcscmp( strW, clr_version[i] )) version = i; if (!wcscmp( strW, clr_version[i] )) version = i;
} }
msi_free( strW ); free( strW );
} }
return version; return version;
} }
...@@ -500,7 +500,7 @@ static WCHAR *build_local_assembly_path( const WCHAR *filename ) ...@@ -500,7 +500,7 @@ static WCHAR *build_local_assembly_path( const WCHAR *filename )
UINT i; UINT i;
WCHAR *ret; WCHAR *ret;
if (!(ret = msi_alloc( (lstrlenW( filename ) + 1) * sizeof(WCHAR) ))) if (!(ret = malloc( (wcslen( filename ) + 1) * sizeof(WCHAR) )))
return NULL; return NULL;
for (i = 0; filename[i]; i++) for (i = 0; filename[i]; i++)
...@@ -543,12 +543,12 @@ static LONG open_local_assembly_key( UINT context, BOOL win32, const WCHAR *file ...@@ -543,12 +543,12 @@ static LONG open_local_assembly_key( UINT context, BOOL win32, const WCHAR *file
if ((res = open_assemblies_key( context, win32, &root ))) if ((res = open_assemblies_key( context, win32, &root )))
{ {
msi_free( path ); free( path );
return res; return res;
} }
res = RegCreateKeyW( root, path, hkey ); res = RegCreateKeyW( root, path, hkey );
RegCloseKey( root ); RegCloseKey( root );
msi_free( path ); free( path );
return res; return res;
} }
...@@ -563,12 +563,12 @@ static LONG delete_local_assembly_key( UINT context, BOOL win32, const WCHAR *fi ...@@ -563,12 +563,12 @@ static LONG delete_local_assembly_key( UINT context, BOOL win32, const WCHAR *fi
if ((res = open_assemblies_key( context, win32, &root ))) if ((res = open_assemblies_key( context, win32, &root )))
{ {
msi_free( path ); free( path );
return res; return res;
} }
res = RegDeleteKeyW( root, path ); res = RegDeleteKeyW( root, path );
RegCloseKey( root ); RegCloseKey( root );
msi_free( path ); free( path );
return res; return res;
} }
......
...@@ -239,7 +239,7 @@ static ULONG WINAPI AutomationObject_Release(IDispatch* iface) ...@@ -239,7 +239,7 @@ static ULONG WINAPI AutomationObject_Release(IDispatch* iface)
{ {
if (tid_ids[This->tid].fn_free) tid_ids[This->tid].fn_free(This); if (tid_ids[This->tid].fn_free) tid_ids[This->tid].fn_free(This);
MsiCloseHandle(This->msiHandle); MsiCloseHandle(This->msiHandle);
msi_free(This); free(This);
} }
return ref; return ref;
...@@ -607,7 +607,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface) ...@@ -607,7 +607,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface)
if (!ref) if (!ref)
{ {
if (This->list) IDispatch_Release(&This->list->autoobj.IDispatch_iface); if (This->list) IDispatch_Release(&This->list->autoobj.IDispatch_iface);
msi_free(This); free(This);
} }
return ref; return ref;
...@@ -703,7 +703,7 @@ static HRESULT create_list_enumerator(ListObject *list, void **ppObj) ...@@ -703,7 +703,7 @@ static HRESULT create_list_enumerator(ListObject *list, void **ppObj)
TRACE("(%p, %p)\n", list, ppObj); TRACE("(%p, %p)\n", list, ppObj);
object = msi_alloc(sizeof(ListEnumerator)); object = malloc(sizeof(ListEnumerator));
/* Set all the VTable references */ /* Set all the VTable references */
object->IEnumVARIANT_iface.lpVtbl = &ListEnumerator_Vtbl; object->IEnumVARIANT_iface.lpVtbl = &ListEnumerator_Vtbl;
...@@ -807,7 +807,7 @@ static HRESULT summaryinfo_invoke( ...@@ -807,7 +807,7 @@ static HRESULT summaryinfo_invoke(
break; break;
case VT_LPSTR: case VT_LPSTR:
if (!(str = msi_alloc(++size * sizeof(WCHAR)))) if (!(str = malloc(++size * sizeof(WCHAR))))
ERR("Out of memory\n"); ERR("Out of memory\n");
else if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, V_I4(&varg0), &type, NULL, else if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, V_I4(&varg0), &type, NULL,
NULL, str, &size)) != ERROR_SUCCESS) NULL, str, &size)) != ERROR_SUCCESS)
...@@ -817,7 +817,7 @@ static HRESULT summaryinfo_invoke( ...@@ -817,7 +817,7 @@ static HRESULT summaryinfo_invoke(
V_VT(pVarResult) = VT_BSTR; V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = SysAllocString(str); V_BSTR(pVarResult) = SysAllocString(str);
} }
msi_free(str); free(str);
break; break;
case VT_FILETIME: case VT_FILETIME:
...@@ -941,11 +941,11 @@ static HRESULT record_invoke( ...@@ -941,11 +941,11 @@ static HRESULT record_invoke(
V_BSTR(pVarResult) = NULL; V_BSTR(pVarResult) = NULL;
if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen)) == ERROR_SUCCESS) if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen)) == ERROR_SUCCESS)
{ {
if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR)))) if (!(szString = malloc((++dwLen) * sizeof(WCHAR))))
ERR("Out of memory\n"); ERR("Out of memory\n");
else if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS) else if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
V_BSTR(pVarResult) = SysAllocString(szString); V_BSTR(pVarResult) = SysAllocString(szString);
msi_free(szString); free(szString);
} }
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
ERR("MsiRecordGetString returned %d\n", ret); ERR("MsiRecordGetString returned %d\n", ret);
...@@ -998,7 +998,7 @@ static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp) ...@@ -998,7 +998,7 @@ static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp)
{ {
AutomationObject *record; AutomationObject *record;
record = msi_alloc(sizeof(*record)); record = malloc(sizeof(*record));
if (!record) return E_OUTOFMEMORY; if (!record) return E_OUTOFMEMORY;
init_automation_object(record, msiHandle, Record_tid); init_automation_object(record, msiHandle, Record_tid);
...@@ -1072,7 +1072,7 @@ static void list_free(AutomationObject *This) ...@@ -1072,7 +1072,7 @@ static void list_free(AutomationObject *This)
for (i = 0; i < list->count; i++) for (i = 0; i < list->count; i++)
VariantClear(&list->data[i]); VariantClear(&list->data[i]);
msi_free(list->data); free(list->data);
} }
static HRESULT get_products_count(const WCHAR *product, int *len) static HRESULT get_products_count(const WCHAR *product, int *len)
...@@ -1109,7 +1109,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch) ...@@ -1109,7 +1109,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch)
HRESULT hr; HRESULT hr;
int i; int i;
list = msi_alloc_zero(sizeof(ListObject)); list = calloc(1, sizeof(ListObject));
if (!list) return E_OUTOFMEMORY; if (!list) return E_OUTOFMEMORY;
init_automation_object(&list->autoobj, 0, StringList_tid); init_automation_object(&list->autoobj, 0, StringList_tid);
...@@ -1123,7 +1123,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch) ...@@ -1123,7 +1123,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch)
return hr; return hr;
} }
list->data = msi_alloc(list->count*sizeof(VARIANT)); list->data = malloc(list->count * sizeof(VARIANT));
if (!list->data) if (!list->data)
{ {
IDispatch_Release(*dispatch); IDispatch_Release(*dispatch);
...@@ -1382,11 +1382,11 @@ static HRESULT session_invoke( ...@@ -1382,11 +1382,11 @@ static HRESULT session_invoke(
V_BSTR(pVarResult) = NULL; V_BSTR(pVarResult) = NULL;
if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen)) == ERROR_SUCCESS) if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen)) == ERROR_SUCCESS)
{ {
if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR)))) if (!(szString = malloc((++dwLen) * sizeof(WCHAR))))
ERR("Out of memory\n"); ERR("Out of memory\n");
else if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS) else if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
V_BSTR(pVarResult) = SysAllocString(szString); V_BSTR(pVarResult) = SysAllocString(szString);
msi_free(szString); free(szString);
} }
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
ERR("MsiGetProperty returned %d\n", ret); ERR("MsiGetProperty returned %d\n", ret);
...@@ -1619,7 +1619,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT ...@@ -1619,7 +1619,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize))) if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %lu\n", GetLastError()); ERR("ExpandEnvironmentStrings returned error %lu\n", GetLastError());
else if (!(szNewString = msi_alloc(dwNewSize * sizeof(WCHAR)))) else if (!(szNewString = malloc(dwNewSize * sizeof(WCHAR))))
ERR("Out of memory\n"); ERR("Out of memory\n");
else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize))) else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %lu\n", GetLastError()); ERR("ExpandEnvironmentStrings returned error %lu\n", GetLastError());
...@@ -1628,7 +1628,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT ...@@ -1628,7 +1628,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT
V_VT(pVarResult) = VT_BSTR; V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = SysAllocStringLen(szNewString, dwNewSize); V_BSTR(pVarResult) = SysAllocStringLen(szNewString, dwNewSize);
} }
msi_free(szNewString); free(szNewString);
break; break;
case REG_DWORD: case REG_DWORD:
...@@ -2047,7 +2047,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, ...@@ -2047,7 +2047,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
goto done; goto done;
} }
szString = msi_alloc(size); szString = malloc(size);
if (!szString) if (!szString)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -2058,14 +2058,14 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, ...@@ -2058,14 +2058,14 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
&type, (LPBYTE)szString, &size); &type, (LPBYTE)szString, &size);
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
{ {
msi_free(szString); free(szString);
hr = DISP_E_BADINDEX; hr = DISP_E_BADINDEX;
goto done; goto done;
} }
variant_from_registry_value(pVarResult, type, variant_from_registry_value(pVarResult, type,
(LPBYTE)szString, size); (LPBYTE)szString, size);
msi_free(szString); free(szString);
break; break;
/* Try to make it into VT_I4, can use VariantChangeType for this. */ /* Try to make it into VT_I4, can use VariantChangeType for this. */
...@@ -2093,7 +2093,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, ...@@ -2093,7 +2093,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
goto done; goto done;
szString = msi_alloc(++size * sizeof(WCHAR)); szString = malloc(++size * sizeof(WCHAR));
if (!szString) if (!szString)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -2115,7 +2115,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, ...@@ -2115,7 +2115,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
V_BSTR(pVarResult) = SysAllocString(szString); V_BSTR(pVarResult) = SysAllocString(szString);
} }
msi_free(szString); free(szString);
} }
done: done:
...@@ -2245,7 +2245,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags, ...@@ -2245,7 +2245,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags,
goto done; goto done;
} }
str = msi_alloc(++size * sizeof(WCHAR)); str = malloc(++size * sizeof(WCHAR));
if (!str) if (!str)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -2263,7 +2263,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags, ...@@ -2263,7 +2263,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags,
hr = S_OK; hr = S_OK;
done: done:
msi_free(str); free(str);
VariantClear(&varg0); VariantClear(&varg0);
VariantClear(&varg1); VariantClear(&varg1);
return hr; return hr;
...@@ -2427,7 +2427,7 @@ HRESULT create_msiserver(IUnknown *outer, void **ppObj) ...@@ -2427,7 +2427,7 @@ HRESULT create_msiserver(IUnknown *outer, void **ppObj)
if (outer) if (outer)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
installer = msi_alloc(sizeof(AutomationObject)); installer = malloc(sizeof(AutomationObject));
if (!installer) return E_OUTOFMEMORY; if (!installer) return E_OUTOFMEMORY;
init_automation_object(installer, 0, Installer_tid); init_automation_object(installer, 0, Installer_tid);
...@@ -2441,7 +2441,7 @@ HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **di ...@@ -2441,7 +2441,7 @@ HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **di
{ {
SessionObject *session; SessionObject *session;
session = msi_alloc(sizeof(SessionObject)); session = malloc(sizeof(SessionObject));
if (!session) return E_OUTOFMEMORY; if (!session) return E_OUTOFMEMORY;
init_automation_object(&session->autoobj, msiHandle, Session_tid); init_automation_object(&session->autoobj, msiHandle, Session_tid);
...@@ -2458,7 +2458,7 @@ static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch) ...@@ -2458,7 +2458,7 @@ static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch)
TRACE("%lu %p\n", msiHandle, dispatch); TRACE("%lu %p\n", msiHandle, dispatch);
database = msi_alloc(sizeof(AutomationObject)); database = malloc(sizeof(AutomationObject));
if (!database) return E_OUTOFMEMORY; if (!database) return E_OUTOFMEMORY;
init_automation_object(database, msiHandle, Database_tid); init_automation_object(database, msiHandle, Database_tid);
...@@ -2474,7 +2474,7 @@ static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch) ...@@ -2474,7 +2474,7 @@ static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch)
TRACE("%lu %p\n", msiHandle, dispatch); TRACE("%lu %p\n", msiHandle, dispatch);
view = msi_alloc(sizeof(AutomationObject)); view = malloc(sizeof(AutomationObject));
if (!view) return E_OUTOFMEMORY; if (!view) return E_OUTOFMEMORY;
init_automation_object(view, msiHandle, View_tid); init_automation_object(view, msiHandle, View_tid);
...@@ -2488,7 +2488,7 @@ static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp) ...@@ -2488,7 +2488,7 @@ static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp)
{ {
AutomationObject *info; AutomationObject *info;
info = msi_alloc(sizeof(*info)); info = malloc(sizeof(*info));
if (!info) return E_OUTOFMEMORY; if (!info) return E_OUTOFMEMORY;
init_automation_object(info, msiHandle, SummaryInfo_tid); init_automation_object(info, msiHandle, SummaryInfo_tid);
......
...@@ -418,8 +418,8 @@ static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub ) ...@@ -418,8 +418,8 @@ static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub )
r = wcsstr( strlower, sublower ); r = wcsstr( strlower, sublower );
if (r) if (r)
r = (LPWSTR)str + (r - strlower); r = (LPWSTR)str + (r - strlower);
msi_free( strlower ); free( strlower );
msi_free( sublower ); free( sublower );
return r; return r;
} }
...@@ -755,7 +755,7 @@ static void *cond_alloc( COND_input *cond, unsigned int sz ) ...@@ -755,7 +755,7 @@ static void *cond_alloc( COND_input *cond, unsigned int sz )
{ {
struct list *mem; struct list *mem;
mem = msi_alloc( sizeof (struct list) + sz ); mem = malloc( sizeof (struct list) + sz );
if( !mem ) if( !mem )
return NULL; return NULL;
...@@ -773,12 +773,12 @@ static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz ) ...@@ -773,12 +773,12 @@ static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz )
new_ptr = cond_alloc( cond, sz ); new_ptr = cond_alloc( cond, sz );
if( !new_ptr ) if( !new_ptr )
{ {
msi_free( ptr ); free( ptr );
return NULL; return NULL;
} }
memcpy( new_ptr, ptr, sz ); memcpy( new_ptr, ptr, sz );
msi_free( ptr ); free( ptr );
return new_ptr; return new_ptr;
} }
...@@ -789,7 +789,7 @@ static void cond_free( void *ptr ) ...@@ -789,7 +789,7 @@ static void cond_free( void *ptr )
if( ptr ) if( ptr )
{ {
list_remove( mem ); list_remove( mem );
msi_free( mem ); free( mem );
} }
} }
...@@ -878,6 +878,6 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio ...@@ -878,6 +878,6 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio
return MSICONDITION_ERROR; return MSICONDITION_ERROR;
r = MsiEvaluateConditionW( hInstall, szwCond ); r = MsiEvaluateConditionW( hInstall, szwCond );
msi_free( szwCond ); free( szwCond );
return r; return r;
} }
...@@ -116,7 +116,7 @@ static UINT CREATE_delete( struct tagMSIVIEW *view ) ...@@ -116,7 +116,7 @@ static UINT CREATE_delete( struct tagMSIVIEW *view )
TRACE("%p\n", cv ); TRACE("%p\n", cv );
msiobj_release( &cv->db->hdr ); msiobj_release( &cv->db->hdr );
msi_free( cv ); free( cv );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -172,7 +172,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, ...@@ -172,7 +172,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
return r; return r;
cv = msi_alloc_zero( sizeof *cv ); cv = calloc( 1, sizeof *cv );
if( !cv ) if( !cv )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -189,7 +189,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, ...@@ -189,7 +189,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
if ( !temp && tempprim ) if ( !temp && tempprim )
{ {
msi_free( cv ); free( cv );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
......
...@@ -159,7 +159,7 @@ static UINT DELETE_delete( struct tagMSIVIEW *view ) ...@@ -159,7 +159,7 @@ static UINT DELETE_delete( struct tagMSIVIEW *view )
if( dv->table ) if( dv->table )
dv->table->ops->delete( dv->table ); dv->table->ops->delete( dv->table );
msi_free( dv ); free( dv );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -193,7 +193,7 @@ UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) ...@@ -193,7 +193,7 @@ UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table )
TRACE("%p\n", dv ); TRACE("%p\n", dv );
dv = msi_alloc_zero( sizeof *dv ); dv = calloc( 1, sizeof *dv );
if( !dv ) if( !dv )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
......
...@@ -67,7 +67,7 @@ static DISTINCTSET ** distinct_insert( DISTINCTSET **x, UINT val, UINT row ) ...@@ -67,7 +67,7 @@ static DISTINCTSET ** distinct_insert( DISTINCTSET **x, UINT val, UINT row )
} }
/* nothing found, so add one */ /* nothing found, so add one */
*x = msi_alloc( sizeof (DISTINCTSET) ); *x = malloc( sizeof(DISTINCTSET) );
if( *x ) if( *x )
{ {
(*x)->val = val; (*x)->val = val;
...@@ -85,7 +85,7 @@ static void distinct_free( DISTINCTSET *x ) ...@@ -85,7 +85,7 @@ static void distinct_free( DISTINCTSET *x )
{ {
DISTINCTSET *next = x->nextrow; DISTINCTSET *next = x->nextrow;
distinct_free( x->nextcol ); distinct_free( x->nextcol );
msi_free( x ); free( x );
x = next; x = next;
} }
} }
...@@ -126,7 +126,7 @@ static UINT DISTINCT_execute( struct tagMSIVIEW *view, MSIRECORD *record ) ...@@ -126,7 +126,7 @@ static UINT DISTINCT_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
return r; return r;
dv->translation = msi_alloc( r_count*sizeof(UINT) ); dv->translation = malloc( r_count * sizeof(UINT) );
if( !dv->translation ) if( !dv->translation )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -178,7 +178,7 @@ static UINT DISTINCT_close( struct tagMSIVIEW *view ) ...@@ -178,7 +178,7 @@ static UINT DISTINCT_close( struct tagMSIVIEW *view )
if( !dv->table ) if( !dv->table )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
msi_free( dv->translation ); free( dv->translation );
dv->translation = NULL; dv->translation = NULL;
dv->row_count = 0; dv->row_count = 0;
...@@ -240,9 +240,9 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view ) ...@@ -240,9 +240,9 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view )
if( dv->table ) if( dv->table )
dv->table->ops->delete( dv->table ); dv->table->ops->delete( dv->table );
msi_free( dv->translation ); free( dv->translation );
msiobj_release( &dv->db->hdr ); msiobj_release( &dv->db->hdr );
msi_free( dv ); free( dv );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -284,7 +284,7 @@ UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) ...@@ -284,7 +284,7 @@ UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table )
return r; return r;
} }
dv = msi_alloc_zero( sizeof *dv ); dv = calloc( 1, sizeof *dv );
if( !dv ) if( !dv )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
......
...@@ -87,7 +87,7 @@ static UINT DROP_delete( struct tagMSIVIEW *view ) ...@@ -87,7 +87,7 @@ static UINT DROP_delete( struct tagMSIVIEW *view )
if( dv->table ) if( dv->table )
dv->table->ops->delete( dv->table ); dv->table->ops->delete( dv->table );
msi_free( dv ); free( dv );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -122,14 +122,14 @@ UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name) ...@@ -122,14 +122,14 @@ UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name)
TRACE("%p %s\n", view, debugstr_w(name)); TRACE("%p %s\n", view, debugstr_w(name));
dv = msi_alloc_zero(sizeof *dv); dv = calloc(1, sizeof *dv);
if(!dv) if(!dv)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
r = TABLE_CreateView(db, name, &dv->table); r = TABLE_CreateView(db, name, &dv->table);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
msi_free( dv ); free( dv );
return r; return r;
} }
......
...@@ -143,17 +143,17 @@ static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWOR ...@@ -143,17 +143,17 @@ static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWOR
ttRecord.uStringOffset = SWAPWORD(ttRecord.uStringOffset); ttRecord.uStringOffset = SWAPWORD(ttRecord.uStringOffset);
SetFilePointer(handle, tblDir.uOffset + ttRecord.uStringOffset + ttNTHeader.uStorageOffset, SetFilePointer(handle, tblDir.uOffset + ttRecord.uStringOffset + ttNTHeader.uStorageOffset,
NULL, FILE_BEGIN); NULL, FILE_BEGIN);
if (!(buf = msi_alloc_zero( ttRecord.uStringLength + sizeof(WCHAR) ))) goto end; if (!(buf = calloc(ttRecord.uStringLength, sizeof(WCHAR)))) goto end;
dwRead = 0; dwRead = 0;
ReadFile(handle, buf, ttRecord.uStringLength, &dwRead, NULL); ReadFile(handle, buf, ttRecord.uStringLength, &dwRead, NULL);
if (dwRead % sizeof(WCHAR)) if (dwRead % sizeof(WCHAR))
{ {
msi_free(buf); free(buf);
goto end; goto end;
} }
for (i = 0; i < dwRead / sizeof(WCHAR); i++) buf[i] = SWAPWORD(buf[i]); for (i = 0; i < dwRead / sizeof(WCHAR); i++) buf[i] = SWAPWORD(buf[i]);
ret = wcsdup(buf); ret = wcsdup(buf);
msi_free(buf); free(buf);
break; break;
} }
} }
...@@ -172,13 +172,13 @@ static WCHAR *font_name_from_file( MSIPACKAGE *package, const WCHAR *filename ) ...@@ -172,13 +172,13 @@ static WCHAR *font_name_from_file( MSIPACKAGE *package, const WCHAR *filename )
if (!name[0]) if (!name[0])
{ {
WARN("empty font name\n"); WARN("empty font name\n");
msi_free( name ); free( name );
return NULL; return NULL;
} }
ret = msi_alloc( (lstrlenW( name ) + lstrlenW( L" (TrueType)" ) + 1 ) * sizeof(WCHAR) ); ret = malloc( wcslen( name ) * sizeof(WCHAR) + sizeof( L" (TrueType)" ) );
lstrcpyW( ret, name ); lstrcpyW( ret, name );
lstrcatW( ret, L" (TrueType)" ); lstrcatW( ret, L" (TrueType)" );
msi_free( name ); free( name );
} }
return ret; return ret;
} }
...@@ -202,9 +202,9 @@ WCHAR *msi_get_font_file_version( MSIPACKAGE *package, const WCHAR *filename ) ...@@ -202,9 +202,9 @@ WCHAR *msi_get_font_file_version( MSIPACKAGE *package, const WCHAR *filename )
else major = 0; else major = 0;
} }
len = lstrlenW( L"%u.%u.0.0" ) + 20; len = lstrlenW( L"%u.%u.0.0" ) + 20;
ret = msi_alloc( len * sizeof(WCHAR) ); ret = malloc( len * sizeof(WCHAR) );
swprintf( ret, len, L"%u.%u.0.0", major, minor ); swprintf( ret, len, L"%u.%u.0.0", major, minor );
msi_free( version ); free( version );
} }
return ret; return ret;
} }
...@@ -254,7 +254,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) ...@@ -254,7 +254,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
msi_reg_set_val_str( hkey2, name, file->TargetPath); msi_reg_set_val_str( hkey2, name, file->TargetPath);
} }
msi_free(name); free(name);
RegCloseKey(hkey1); RegCloseKey(hkey1);
RegCloseKey(hkey2); RegCloseKey(hkey2);
...@@ -267,7 +267,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) ...@@ -267,7 +267,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
MSI_RecordSetStringW( uirow, 1, p ); MSI_RecordSetStringW( uirow, 1, p );
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
msi_free( uipath ); free( uipath );
/* FIXME: call msi_ui_progress? */ /* FIXME: call msi_ui_progress? */
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -335,7 +335,7 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param ) ...@@ -335,7 +335,7 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
RegDeleteValueW( hkey2, name ); RegDeleteValueW( hkey2, name );
} }
msi_free( name ); free( name );
RegCloseKey( hkey1 ); RegCloseKey( hkey1 );
RegCloseKey( hkey2 ); RegCloseKey( hkey2 );
...@@ -348,7 +348,7 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param ) ...@@ -348,7 +348,7 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
MSI_RecordSetStringW( uirow, 1, p ); MSI_RecordSetStringW( uirow, 1, p );
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow);
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
msi_free( uipath ); free( uipath );
/* FIXME: call msi_ui_progress? */ /* FIXME: call msi_ui_progress? */
return ERROR_SUCCESS; return ERROR_SUCCESS;
......
...@@ -70,7 +70,7 @@ static unsigned int msihandletable_size = 0; ...@@ -70,7 +70,7 @@ static unsigned int msihandletable_size = 0;
void msi_free_handle_table(void) void msi_free_handle_table(void)
{ {
msi_free( msihandletable ); free( msihandletable );
msihandletable = NULL; msihandletable = NULL;
msihandletable_size = 0; msihandletable_size = 0;
DeleteCriticalSection(&MSI_handle_cs); DeleteCriticalSection(&MSI_handle_cs);
...@@ -92,12 +92,12 @@ static MSIHANDLE alloc_handle_table_entry(void) ...@@ -92,12 +92,12 @@ static MSIHANDLE alloc_handle_table_entry(void)
if (msihandletable_size == 0) if (msihandletable_size == 0)
{ {
newsize = 256; newsize = 256;
p = msi_alloc_zero(newsize * sizeof(*p)); p = calloc(newsize, sizeof(*p));
} }
else else
{ {
newsize = msihandletable_size * 2; newsize = msihandletable_size * 2;
p = msi_realloc(msihandletable, newsize * sizeof(*p)); p = realloc(msihandletable, newsize * sizeof(*p));
if (p) memset(p + msihandletable_size, 0, (newsize - msihandletable_size) * sizeof(*p)); if (p) memset(p + msihandletable_size, 0, (newsize - msihandletable_size) * sizeof(*p));
} }
if (!p) if (!p)
...@@ -202,7 +202,7 @@ void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) ...@@ -202,7 +202,7 @@ void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy )
{ {
MSIOBJECTHDR *info; MSIOBJECTHDR *info;
info = msi_alloc_zero( size ); info = calloc( 1, size );
if( info ) if( info )
{ {
info->magic = MSIHANDLE_MAGIC; info->magic = MSIHANDLE_MAGIC;
...@@ -257,7 +257,7 @@ int msiobj_release( MSIOBJECTHDR *info ) ...@@ -257,7 +257,7 @@ int msiobj_release( MSIOBJECTHDR *info )
if( info->destructor ) if( info->destructor )
info->destructor( info ); info->destructor( info );
TRACE("object %p destroyed\n", info); TRACE("object %p destroyed\n", info);
msi_free( info ); free( info );
} }
return ret; return ret;
......
...@@ -312,7 +312,7 @@ static UINT INSERT_delete( struct tagMSIVIEW *view ) ...@@ -312,7 +312,7 @@ static UINT INSERT_delete( struct tagMSIVIEW *view )
if( sv ) if( sv )
sv->ops->delete( sv ); sv->ops->delete( sv );
msiobj_release( &iv->db->hdr ); msiobj_release( &iv->db->hdr );
msi_free( iv ); free( iv );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -373,7 +373,7 @@ UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, ...@@ -373,7 +373,7 @@ UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
return r; return r;
} }
iv = msi_alloc_zero( sizeof *iv ); iv = calloc( 1, sizeof *iv );
if( !iv ) if( !iv )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
......
...@@ -54,7 +54,7 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction ) ...@@ -54,7 +54,7 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
ret = MsiDoActionW( hInstall, szwAction ); ret = MsiDoActionW( hInstall, szwAction );
msi_free( szwAction ); free( szwAction );
return ret; return ret;
} }
...@@ -113,7 +113,7 @@ UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode ...@@ -113,7 +113,7 @@ UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
ret = MsiSequenceW( hInstall, szwTable, iSequenceMode ); ret = MsiSequenceW( hInstall, szwTable, iSequenceMode );
msi_free( szwTable ); free( szwTable );
return ret; return ret;
} }
...@@ -398,7 +398,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL ...@@ -398,7 +398,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL
TRACE("-> %s\n", debugstr_w(path)); TRACE("-> %s\n", debugstr_w(path));
f->ResolvedSource = wcsdup( path ); f->ResolvedSource = wcsdup( path );
msi_free( p ); free( p );
return path; return path;
} }
...@@ -533,8 +533,8 @@ UINT WINAPI MsiSetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder, ...@@ -533,8 +533,8 @@ UINT WINAPI MsiSetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
rc = MsiSetTargetPathW( hInstall, szwFolder, szwFolderPath ); rc = MsiSetTargetPathW( hInstall, szwFolder, szwFolderPath );
end: end:
msi_free(szwFolder); free(szwFolder);
msi_free(szwFolderPath); free(szwFolderPath);
return rc; return rc;
} }
...@@ -548,7 +548,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR ...@@ -548,7 +548,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR
if (!(target_path = msi_normalize_path( path ))) return; if (!(target_path = msi_normalize_path( path ))) return;
if (wcscmp( target_path, folder->ResolvedTarget )) if (wcscmp( target_path, folder->ResolvedTarget ))
{ {
msi_free( folder->ResolvedTarget ); free( folder->ResolvedTarget );
folder->ResolvedTarget = target_path; folder->ResolvedTarget = target_path;
msi_set_property( package->db, folder->Directory, folder->ResolvedTarget, -1 ); msi_set_property( package->db, folder->Directory, folder->ResolvedTarget, -1 );
...@@ -558,7 +558,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR ...@@ -558,7 +558,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR
msi_resolve_target_folder( package, child->Directory, FALSE ); msi_resolve_target_folder( package, child->Directory, FALSE );
} }
} }
else msi_free( target_path ); else free( target_path );
} }
UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolderPath ) UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolderPath )
...@@ -588,7 +588,7 @@ UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolder ...@@ -588,7 +588,7 @@ UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolder
if (!comp->Enabled || msi_is_global_assembly( comp )) continue; if (!comp->Enabled || msi_is_global_assembly( comp )) continue;
dir = msi_get_target_folder( package, comp->Directory ); dir = msi_get_target_folder( package, comp->Directory );
msi_free( file->TargetPath ); free( file->TargetPath );
file->TargetPath = msi_build_directory_name( 2, dir, file->FileName ); file->TargetPath = msi_build_directory_name( 2, dir, file->FileName );
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -824,7 +824,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, ...@@ -824,7 +824,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
rc = MsiSetFeatureStateW(hInstall,szwFeature, iState); rc = MsiSetFeatureStateW(hInstall,szwFeature, iState);
msi_free(szwFeature); free(szwFeature);
return rc; return rc;
} }
...@@ -995,7 +995,7 @@ UINT WINAPI MsiSetFeatureAttributesA( MSIHANDLE handle, LPCSTR feature, DWORD at ...@@ -995,7 +995,7 @@ UINT WINAPI MsiSetFeatureAttributesA( MSIHANDLE handle, LPCSTR feature, DWORD at
if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY; if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY;
r = MsiSetFeatureAttributesW( handle, featureW, attrs ); r = MsiSetFeatureAttributesW( handle, featureW, attrs );
msi_free( featureW ); free( featureW );
return r; return r;
} }
...@@ -1031,11 +1031,11 @@ UINT WINAPI MsiSetFeatureAttributesW( MSIHANDLE handle, LPCWSTR name, DWORD attr ...@@ -1031,11 +1031,11 @@ UINT WINAPI MsiSetFeatureAttributesW( MSIHANDLE handle, LPCWSTR name, DWORD attr
costing = msi_dup_property( package->db, L"CostingComplete" ); costing = msi_dup_property( package->db, L"CostingComplete" );
if (!costing || !wcscmp( costing, L"1" )) if (!costing || !wcscmp( costing, L"1" ))
{ {
msi_free( costing ); free( costing );
msiobj_release( &package->hdr ); msiobj_release( &package->hdr );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
msi_free( costing ); free( costing );
if (!(feature = msi_get_loaded_feature( package, name ))) if (!(feature = msi_get_loaded_feature( package, name )))
{ {
msiobj_release( &package->hdr ); msiobj_release( &package->hdr );
...@@ -1058,7 +1058,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, ...@@ -1058,7 +1058,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
if (szFeature && !(szwFeature = strdupAtoW(szFeature))) return ERROR_OUTOFMEMORY; if (szFeature && !(szwFeature = strdupAtoW(szFeature))) return ERROR_OUTOFMEMORY;
rc = MsiGetFeatureStateW(hInstall, szwFeature, piInstalled, piAction); rc = MsiGetFeatureStateW(hInstall, szwFeature, piInstalled, piAction);
msi_free( szwFeature); free(szwFeature);
return rc; return rc;
} }
...@@ -1135,7 +1135,7 @@ UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall, LPCSTR szFeature, ...@@ -1135,7 +1135,7 @@ UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall, LPCSTR szFeature,
rc = MsiGetFeatureCostW(hInstall, szwFeature, iCostTree, iState, piCost); rc = MsiGetFeatureCostW(hInstall, szwFeature, iCostTree, iState, piCost);
msi_free(szwFeature); free(szwFeature);
return rc; return rc;
} }
...@@ -1268,15 +1268,15 @@ UINT WINAPI MsiGetFeatureInfoA( MSIHANDLE handle, const char *feature, DWORD *at ...@@ -1268,15 +1268,15 @@ UINT WINAPI MsiGetFeatureInfoA( MSIHANDLE handle, const char *feature, DWORD *at
if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY; if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY;
if (title && title_len && !(titleW = msi_alloc( *title_len * sizeof(WCHAR) ))) if (title && title_len && !(titleW = malloc( *title_len * sizeof(WCHAR) )))
{ {
msi_free( featureW ); free( featureW );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
if (help && help_len && !(helpW = msi_alloc( *help_len * sizeof(WCHAR) ))) if (help && help_len && !(helpW = malloc( *help_len * sizeof(WCHAR) )))
{ {
msi_free( featureW ); free( featureW );
msi_free( titleW ); free( titleW );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
r = MsiGetFeatureInfoW( handle, featureW, attrs, titleW, title_len, helpW, help_len ); r = MsiGetFeatureInfoW( handle, featureW, attrs, titleW, title_len, helpW, help_len );
...@@ -1285,9 +1285,9 @@ UINT WINAPI MsiGetFeatureInfoA( MSIHANDLE handle, const char *feature, DWORD *at ...@@ -1285,9 +1285,9 @@ UINT WINAPI MsiGetFeatureInfoA( MSIHANDLE handle, const char *feature, DWORD *at
if (titleW) WideCharToMultiByte( CP_ACP, 0, titleW, -1, title, *title_len + 1, NULL, NULL ); if (titleW) WideCharToMultiByte( CP_ACP, 0, titleW, -1, title, *title_len + 1, NULL, NULL );
if (helpW) WideCharToMultiByte( CP_ACP, 0, helpW, -1, help, *help_len + 1, NULL, NULL ); if (helpW) WideCharToMultiByte( CP_ACP, 0, helpW, -1, help, *help_len + 1, NULL, NULL );
} }
msi_free( titleW ); free( titleW );
msi_free( helpW ); free( helpW );
msi_free( featureW ); free( featureW );
return r; return r;
} }
...@@ -1385,7 +1385,7 @@ UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, ...@@ -1385,7 +1385,7 @@ UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
rc = MsiSetComponentStateW(hInstall, szwComponent, iState); rc = MsiSetComponentStateW(hInstall, szwComponent, iState);
msi_free(szwComponent); free(szwComponent);
return rc; return rc;
} }
...@@ -1403,7 +1403,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, ...@@ -1403,7 +1403,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction); rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction);
msi_free( szwComponent); free(szwComponent);
return rc; return rc;
} }
...@@ -1648,6 +1648,6 @@ UINT WINAPI MsiGetFeatureValidStatesA( MSIHANDLE hInstall, const char *szFeature ...@@ -1648,6 +1648,6 @@ UINT WINAPI MsiGetFeatureValidStatesA( MSIHANDLE hInstall, const char *szFeature
UINT ret; UINT ret;
WCHAR *szwFeature = strdupAtoW(szFeature); WCHAR *szwFeature = strdupAtoW(szFeature);
ret = MsiGetFeatureValidStatesW(hInstall, szwFeature, pInstallState); ret = MsiGetFeatureValidStatesW(hInstall, szwFeature, pInstallState);
msi_free(szwFeature); free(szwFeature);
return ret; return ret;
} }
...@@ -80,7 +80,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -80,7 +80,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
if (lpvReserved) break; if (lpvReserved) break;
msi_dialog_unregister_class(); msi_dialog_unregister_class();
msi_free_handle_table(); msi_free_handle_table();
msi_free( gszLogFile ); free( gszLogFile );
release_typelib(); release_typelib();
break; break;
} }
......
...@@ -1138,30 +1138,6 @@ extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR f ...@@ -1138,30 +1138,6 @@ extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR f
/* User interface messages from the actions */ /* User interface messages from the actions */
extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int) DECLSPEC_HIDDEN; extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int) DECLSPEC_HIDDEN;
/* memory allocation macro functions */
static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
static inline void *msi_alloc( size_t len )
{
return malloc( len );
}
static void *msi_alloc_zero( size_t len ) __WINE_ALLOC_SIZE(1);
static inline void *msi_alloc_zero( size_t len )
{
return calloc( 1, len );
}
static void *msi_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2);
static inline void *msi_realloc( void *mem, size_t len )
{
return realloc( mem, len );
}
static inline void msi_free( void *mem )
{
free( mem );
}
static inline char *strdupWtoA( LPCWSTR str ) static inline char *strdupWtoA( LPCWSTR str )
{ {
LPSTR ret = NULL; LPSTR ret = NULL;
...@@ -1169,7 +1145,7 @@ static inline char *strdupWtoA( LPCWSTR str ) ...@@ -1169,7 +1145,7 @@ static inline char *strdupWtoA( LPCWSTR str )
if (!str) return ret; if (!str) return ret;
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ret = msi_alloc( len ); ret = malloc( len );
if (ret) if (ret)
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
return ret; return ret;
...@@ -1182,7 +1158,7 @@ static inline LPWSTR strdupAtoW( LPCSTR str ) ...@@ -1182,7 +1158,7 @@ static inline LPWSTR strdupAtoW( LPCSTR str )
if (!str) return ret; if (!str) return ret;
len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
ret = msi_alloc( len * sizeof(WCHAR) ); ret = malloc( len * sizeof(WCHAR) );
if (ret) if (ret)
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
return ret; return ret;
......
...@@ -52,7 +52,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg ) ...@@ -52,7 +52,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg )
LIST_FOR_EACH_SAFE( ptr, t, &query->mem ) LIST_FOR_EACH_SAFE( ptr, t, &query->mem )
{ {
msi_free( ptr ); free( ptr );
} }
} }
...@@ -103,7 +103,7 @@ UINT WINAPI MsiDatabaseOpenViewA( MSIHANDLE hdb, const char *szQuery, MSIHANDLE ...@@ -103,7 +103,7 @@ UINT WINAPI MsiDatabaseOpenViewA( MSIHANDLE hdb, const char *szQuery, MSIHANDLE
r = MsiDatabaseOpenViewW( hdb, szwQuery, phView); r = MsiDatabaseOpenViewW( hdb, szwQuery, phView);
msi_free( szwQuery ); free( szwQuery );
return r; return r;
} }
...@@ -145,18 +145,18 @@ UINT WINAPIV MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... ) ...@@ -145,18 +145,18 @@ UINT WINAPIV MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
for (;;) for (;;)
{ {
va_list va; va_list va;
query = msi_alloc( size*sizeof(WCHAR) ); query = malloc(size * sizeof(WCHAR));
va_start(va, fmt); va_start(va, fmt);
res = vswprintf(query, size, fmt, va); res = vswprintf(query, size, fmt, va);
va_end(va); va_end(va);
if (res == -1) size *= 2; if (res == -1) size *= 2;
else if (res >= size) size = res + 1; else if (res >= size) size = res + 1;
else break; else break;
msi_free( query ); free(query);
} }
/* perform the query */ /* perform the query */
r = MSI_DatabaseOpenViewW(db, query, view); r = MSI_DatabaseOpenViewW(db, query, view);
msi_free(query); free(query);
return r; return r;
} }
...@@ -210,18 +210,18 @@ MSIRECORD * WINAPIV MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... ) ...@@ -210,18 +210,18 @@ MSIRECORD * WINAPIV MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... )
for (;;) for (;;)
{ {
va_list va; va_list va;
query = msi_alloc( size*sizeof(WCHAR) ); query = malloc(size * sizeof(WCHAR));
va_start(va, fmt); va_start(va, fmt);
res = vswprintf(query, size, fmt, va); res = vswprintf(query, size, fmt, va);
va_end(va); va_end(va);
if (res == -1) size *= 2; if (res == -1) size *= 2;
else if (res >= size) size = res + 1; else if (res >= size) size = res + 1;
else break; else break;
msi_free( query ); free(query);
} }
/* perform the query */ /* perform the query */
r = MSI_DatabaseOpenViewW(db, query, &view); r = MSI_DatabaseOpenViewW(db, query, &view);
msi_free(query); free(query);
if( r == ERROR_SUCCESS ) if( r == ERROR_SUCCESS )
{ {
...@@ -942,7 +942,7 @@ UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb, const char *transform, in ...@@ -942,7 +942,7 @@ UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb, const char *transform, in
return ERROR_NOT_ENOUGH_MEMORY; return ERROR_NOT_ENOUGH_MEMORY;
ret = MsiDatabaseApplyTransformW( hdb, wstr, error_cond ); ret = MsiDatabaseApplyTransformW( hdb, wstr, error_cond );
msi_free( wstr ); free( wstr );
return ret; return ret;
} }
...@@ -1002,7 +1002,7 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb ) ...@@ -1002,7 +1002,7 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb )
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
msi_free( db->deletefile ); free( db->deletefile );
db->deletefile = NULL; db->deletefile = NULL;
} }
...@@ -1140,7 +1140,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA( MSIHANDLE hdb, const char *table, MSIHAN ...@@ -1140,7 +1140,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA( MSIHANDLE hdb, const char *table, MSIHAN
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec ); r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec );
msi_free( szwTable ); free( szwTable );
return r; return r;
} }
...@@ -1159,7 +1159,7 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentA( MSIHANDLE hDatabase, const ch ...@@ -1159,7 +1159,7 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentA( MSIHANDLE hDatabase, const ch
return MSICONDITION_ERROR; return MSICONDITION_ERROR;
} }
r = MsiDatabaseIsTablePersistentW( hDatabase, szwTableName ); r = MsiDatabaseIsTablePersistentW( hDatabase, szwTableName );
msi_free( szwTableName ); free( szwTableName );
return r; return r;
} }
......
...@@ -54,7 +54,7 @@ static void MSI_FreeField( MSIFIELD *field ) ...@@ -54,7 +54,7 @@ static void MSI_FreeField( MSIFIELD *field )
case MSIFIELD_INT: case MSIFIELD_INT:
break; break;
case MSIFIELD_WSTR: case MSIFIELD_WSTR:
msi_free( field->u.szwVal); free( field->u.szwVal);
break; break;
case MSIFIELD_STREAM: case MSIFIELD_STREAM:
IStream_Release( field->u.stream ); IStream_Release( field->u.stream );
...@@ -157,7 +157,7 @@ WCHAR *msi_strdupW( const WCHAR *value, int len ) ...@@ -157,7 +157,7 @@ WCHAR *msi_strdupW( const WCHAR *value, int len )
WCHAR *ret; WCHAR *ret;
if (!value) return NULL; if (!value) return NULL;
if (!(ret = msi_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL; if (!(ret = malloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
memcpy( ret, value, len * sizeof(WCHAR) ); memcpy( ret, value, len * sizeof(WCHAR) );
ret[len] = 0; ret[len] = 0;
return ret; return ret;
...@@ -559,14 +559,14 @@ UINT WINAPI MsiRecordSetStringA( MSIHANDLE handle, UINT iField, const char *szVa ...@@ -559,14 +559,14 @@ UINT WINAPI MsiRecordSetStringA( MSIHANDLE handle, UINT iField, const char *szVa
rec = msihandle2msiinfo( handle, MSIHANDLETYPE_RECORD ); rec = msihandle2msiinfo( handle, MSIHANDLETYPE_RECORD );
if( !rec ) if( !rec )
{ {
msi_free( valueW ); free( valueW );
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
} }
msiobj_lock( &rec->hdr ); msiobj_lock( &rec->hdr );
ret = MSI_RecordSetStringW( rec, iField, valueW ); ret = MSI_RecordSetStringW( rec, iField, valueW );
msiobj_unlock( &rec->hdr ); msiobj_unlock( &rec->hdr );
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
msi_free( valueW ); free( valueW );
return ret; return ret;
} }
...@@ -735,7 +735,7 @@ UINT WINAPI MsiRecordSetStreamA( MSIHANDLE hRecord, UINT iField, const char *szF ...@@ -735,7 +735,7 @@ UINT WINAPI MsiRecordSetStreamA( MSIHANDLE hRecord, UINT iField, const char *szF
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
ret = MsiRecordSetStreamW(hRecord, iField, wstr); ret = MsiRecordSetStreamW(hRecord, iField, wstr);
msi_free(wstr); free(wstr);
return ret; return ret;
} }
...@@ -1012,14 +1012,14 @@ WCHAR *msi_dup_record_field( MSIRECORD *rec, INT field ) ...@@ -1012,14 +1012,14 @@ WCHAR *msi_dup_record_field( MSIRECORD *rec, INT field )
return NULL; return NULL;
sz++; sz++;
str = msi_alloc( sz * sizeof(WCHAR) ); str = malloc( sz * sizeof(WCHAR) );
if (!str) return NULL; if (!str) return NULL;
str[0] = 0; str[0] = 0;
r = MSI_RecordGetStringW( rec, field, str, &sz ); r = MSI_RecordGetStringW( rec, field, str, &sz );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
ERR("failed to get string!\n"); ERR("failed to get string!\n");
msi_free( str ); free( str );
return NULL; return NULL;
} }
return str; return str;
......
...@@ -251,7 +251,7 @@ LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name ) ...@@ -251,7 +251,7 @@ LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name )
return NULL; return NULL;
len += sizeof (WCHAR); len += sizeof (WCHAR);
val = msi_alloc( len ); val = malloc( len );
if (!val) if (!val)
return NULL; return NULL;
val[0] = 0; val[0] = 0;
...@@ -274,15 +274,15 @@ static WCHAR *get_user_sid(void) ...@@ -274,15 +274,15 @@ static WCHAR *get_user_sid(void)
WCHAR *ret; WCHAR *ret;
if (!OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &token )) return NULL; if (!OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &token )) return NULL;
if (!(user = msi_alloc( size ))) if (!(user = malloc( size )))
{ {
CloseHandle( token ); CloseHandle( token );
return NULL; return NULL;
} }
if (!GetTokenInformation( token, TokenUser, user, size, &size )) if (!GetTokenInformation( token, TokenUser, user, size, &size ))
{ {
msi_free( user ); free( user );
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER || !(user = msi_alloc( size ))) if (GetLastError() != ERROR_INSUFFICIENT_BUFFER || !(user = malloc( size )))
{ {
CloseHandle( token ); CloseHandle( token );
return NULL; return NULL;
...@@ -292,10 +292,10 @@ static WCHAR *get_user_sid(void) ...@@ -292,10 +292,10 @@ static WCHAR *get_user_sid(void)
CloseHandle( token ); CloseHandle( token );
if (!ConvertSidToStringSidW( user->User.Sid, &ret )) if (!ConvertSidToStringSidW( user->User.Sid, &ret ))
{ {
msi_free( user ); free( user );
return NULL; return NULL;
} }
msi_free( user ); free( user );
return ret; return ret;
} }
...@@ -1016,7 +1016,7 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct, ...@@ -1016,7 +1016,7 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct,
szComponent, MAX_FEATURE_CHARS+1, NULL, NULL ); szComponent, MAX_FEATURE_CHARS+1, NULL, NULL );
} }
msi_free( str ); free( str );
return r; return r;
} }
...@@ -1070,7 +1070,7 @@ UINT WINAPI MsiEnumFeaturesA( const char *szProduct, DWORD index, char *szFeatur ...@@ -1070,7 +1070,7 @@ UINT WINAPI MsiEnumFeaturesA( const char *szProduct, DWORD index, char *szFeatur
WideCharToMultiByte(CP_ACP, 0, szwParent, -1, szParent, GUID_SIZE, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, szwParent, -1, szParent, GUID_SIZE, NULL, NULL);
} }
msi_free( szwProduct); free(szwProduct);
return r; return r;
} }
...@@ -1132,9 +1132,9 @@ UINT WINAPI MsiEnumComponentsExA( const char *user_sid, DWORD ctx, DWORD index, ...@@ -1132,9 +1132,9 @@ UINT WINAPI MsiEnumComponentsExA( const char *user_sid, DWORD ctx, DWORD index,
if (sid && !sid_len) return ERROR_INVALID_PARAMETER; if (sid && !sid_len) return ERROR_INVALID_PARAMETER;
if (user_sid && !(user_sidW = strdupAtoW( user_sid ))) return ERROR_OUTOFMEMORY; if (user_sid && !(user_sidW = strdupAtoW( user_sid ))) return ERROR_OUTOFMEMORY;
if (sid && !(sidW = msi_alloc( *sid_len * sizeof(WCHAR) ))) if (sid && !(sidW = malloc( *sid_len * sizeof(WCHAR) )))
{ {
msi_free( user_sidW ); free( user_sidW );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
r = MsiEnumComponentsExW( user_sidW, ctx, index, guidW, installed_ctx, sidW, sid_len ); r = MsiEnumComponentsExW( user_sidW, ctx, index, guidW, installed_ctx, sidW, sid_len );
...@@ -1143,8 +1143,8 @@ UINT WINAPI MsiEnumComponentsExA( const char *user_sid, DWORD ctx, DWORD index, ...@@ -1143,8 +1143,8 @@ UINT WINAPI MsiEnumComponentsExA( const char *user_sid, DWORD ctx, DWORD index,
if (guid) WideCharToMultiByte( CP_ACP, 0, guidW, GUID_SIZE, guid, GUID_SIZE, NULL, NULL ); if (guid) WideCharToMultiByte( CP_ACP, 0, guidW, GUID_SIZE, guid, GUID_SIZE, NULL, NULL );
if (sid) WideCharToMultiByte( CP_ACP, 0, sidW, *sid_len + 1, sid, *sid_len + 1, NULL, NULL ); if (sid) WideCharToMultiByte( CP_ACP, 0, sidW, *sid_len + 1, sid, *sid_len + 1, NULL, NULL );
} }
msi_free( user_sidW ); free( user_sidW );
msi_free( sidW ); free( sidW );
return r; return r;
} }
...@@ -1347,7 +1347,7 @@ UINT WINAPI MsiEnumClientsA( const char *szComponent, DWORD index, char *szProdu ...@@ -1347,7 +1347,7 @@ UINT WINAPI MsiEnumClientsA( const char *szComponent, DWORD index, char *szProdu
if( r == ERROR_SUCCESS ) if( r == ERROR_SUCCESS )
WideCharToMultiByte(CP_ACP, 0, szwProduct, -1, szProduct, GUID_SIZE, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, szwProduct, -1, szProduct, GUID_SIZE, NULL, NULL);
msi_free( szwComponent); free(szwComponent);
return r; return r;
} }
...@@ -1429,13 +1429,13 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, ...@@ -1429,13 +1429,13 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex,
/* figure out how big the name is we want to return */ /* figure out how big the name is we want to return */
name_max = 0x10; name_max = 0x10;
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
name = msi_alloc( name_max * sizeof(WCHAR) ); name = malloc( name_max * sizeof(WCHAR) );
if (!name) if (!name)
goto end; goto end;
val_max = 0x10; val_max = 0x10;
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
val = msi_alloc( val_max ); val = malloc( val_max );
if (!val) if (!val)
goto end; goto end;
...@@ -1460,8 +1460,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, ...@@ -1460,8 +1460,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex,
if (name_sz + 1 >= name_max) if (name_sz + 1 >= name_max)
{ {
name_max *= 2; name_max *= 2;
msi_free( name ); free( name );
name = msi_alloc( name_max * sizeof (WCHAR) ); name = malloc( name_max * sizeof (WCHAR) );
if (!name) if (!name)
goto end; goto end;
continue; continue;
...@@ -1469,8 +1469,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, ...@@ -1469,8 +1469,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex,
if (val_sz > val_max) if (val_sz > val_max)
{ {
val_max = val_sz + sizeof (WCHAR); val_max = val_sz + sizeof (WCHAR);
msi_free( val ); free( val );
val = msi_alloc( val_max * sizeof (WCHAR) ); val = malloc( val_max * sizeof (WCHAR) );
if (!val) if (!val)
goto end; goto end;
continue; continue;
...@@ -1493,8 +1493,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, ...@@ -1493,8 +1493,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex,
r = r2; r = r2;
end: end:
msi_free(val); free(val);
msi_free(name); free(name);
RegCloseKey(key); RegCloseKey(key);
return r; return r;
} }
...@@ -1525,7 +1525,7 @@ UINT WINAPI MsiEnumComponentQualifiersA( const char *szComponent, DWORD iIndex, ...@@ -1525,7 +1525,7 @@ UINT WINAPI MsiEnumComponentQualifiersA( const char *szComponent, DWORD iIndex,
r = MSI_EnumComponentQualifiers( comp, iIndex, r = MSI_EnumComponentQualifiers( comp, iIndex,
&qual, pcchQualifierBuf, &appdata, pcchApplicationDataBuf ); &qual, pcchQualifierBuf, &appdata, pcchApplicationDataBuf );
msi_free( comp ); free( comp );
return r; return r;
} }
...@@ -1608,7 +1608,7 @@ UINT WINAPI MsiEnumRelatedProductsA( const char *szUpgradeCode, DWORD dwReserved ...@@ -1608,7 +1608,7 @@ UINT WINAPI MsiEnumRelatedProductsA( const char *szUpgradeCode, DWORD dwReserved
WideCharToMultiByte( CP_ACP, 0, productW, GUID_SIZE, WideCharToMultiByte( CP_ACP, 0, productW, GUID_SIZE,
lpProductBuf, GUID_SIZE, NULL, NULL ); lpProductBuf, GUID_SIZE, NULL, NULL );
} }
msi_free( szwUpgradeCode); free( szwUpgradeCode );
return r; return r;
} }
...@@ -1654,7 +1654,7 @@ UINT WINAPI MsiEnumPatchesExA( const char *szProductCode, const char *szUserSid, ...@@ -1654,7 +1654,7 @@ UINT WINAPI MsiEnumPatchesExA( const char *szProductCode, const char *szUserSid,
goto done; goto done;
} }
targsid = msi_alloc(++len * sizeof(WCHAR)); targsid = malloc(++len * sizeof(WCHAR));
if (!targsid) if (!targsid)
{ {
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
...@@ -1680,9 +1680,9 @@ UINT WINAPI MsiEnumPatchesExA( const char *szProductCode, const char *szUserSid, ...@@ -1680,9 +1680,9 @@ UINT WINAPI MsiEnumPatchesExA( const char *szProductCode, const char *szUserSid,
*pcchTargetUserSid = len; *pcchTargetUserSid = len;
done: done:
msi_free(prodcode); free(prodcode);
msi_free(usersid); free(usersid);
msi_free(targsid); free(targsid);
return r; return r;
} }
...@@ -1761,7 +1761,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, ...@@ -1761,7 +1761,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
goto done; goto done;
} }
patches = msi_alloc(size); patches = malloc(size);
if (!patches) if (!patches)
{ {
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
...@@ -1789,7 +1789,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, ...@@ -1789,7 +1789,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
if (transforms) if (transforms)
{ {
*transforms = msi_alloc(size); *transforms = malloc(size);
if (!*transforms) if (!*transforms)
{ {
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
...@@ -1896,7 +1896,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, ...@@ -1896,7 +1896,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
done: done:
RegCloseKey(prod); RegCloseKey(prod);
msi_free(patches); free(patches);
return r; return r;
} }
...@@ -2031,7 +2031,7 @@ UINT WINAPI MsiEnumPatchesA( const char *szProduct, DWORD iPatchIndex, char *lpP ...@@ -2031,7 +2031,7 @@ UINT WINAPI MsiEnumPatchesA( const char *szProduct, DWORD iPatchIndex, char *lpP
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
len = *pcchTransformsBuf; len = *pcchTransformsBuf;
transforms = msi_alloc( len * sizeof(WCHAR) ); transforms = malloc(len * sizeof(WCHAR));
if (!transforms) if (!transforms)
{ {
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
...@@ -2058,8 +2058,8 @@ UINT WINAPI MsiEnumPatchesA( const char *szProduct, DWORD iPatchIndex, char *lpP ...@@ -2058,8 +2058,8 @@ UINT WINAPI MsiEnumPatchesA( const char *szProduct, DWORD iPatchIndex, char *lpP
*pcchTransformsBuf = strlen( lpTransformsBuf ); *pcchTransformsBuf = strlen( lpTransformsBuf );
done: done:
msi_free(transforms); free(transforms);
msi_free(product); free(product);
return r; return r;
} }
...@@ -2110,7 +2110,7 @@ UINT WINAPI MsiEnumPatchesW( const WCHAR *szProduct, DWORD iPatchIndex, WCHAR *l ...@@ -2110,7 +2110,7 @@ UINT WINAPI MsiEnumPatchesW( const WCHAR *szProduct, DWORD iPatchIndex, WCHAR *l
*pcchTransformsBuf = lstrlenW(transforms); *pcchTransformsBuf = lstrlenW(transforms);
done: done:
msi_free(transforms); free(transforms);
return r; return r;
} }
...@@ -2128,13 +2128,13 @@ UINT WINAPI MsiEnumProductsExA( const char *product, const char *usersid, DWORD ...@@ -2128,13 +2128,13 @@ UINT WINAPI MsiEnumProductsExA( const char *product, const char *usersid, DWORD
if (product && !(productW = strdupAtoW( product ))) return ERROR_OUTOFMEMORY; if (product && !(productW = strdupAtoW( product ))) return ERROR_OUTOFMEMORY;
if (usersid && !(usersidW = strdupAtoW( usersid ))) if (usersid && !(usersidW = strdupAtoW( usersid )))
{ {
msi_free( productW ); free( productW );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
if (sid && !(sidW = msi_alloc( *sid_len * sizeof(WCHAR) ))) if (sid && !(sidW = malloc( *sid_len * sizeof(WCHAR) )))
{ {
msi_free( usersidW ); free( usersidW );
msi_free( productW ); free( productW );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
r = MsiEnumProductsExW( productW, usersidW, ctx, index, installed_productW, r = MsiEnumProductsExW( productW, usersidW, ctx, index, installed_productW,
...@@ -2145,9 +2145,9 @@ UINT WINAPI MsiEnumProductsExA( const char *product, const char *usersid, DWORD ...@@ -2145,9 +2145,9 @@ UINT WINAPI MsiEnumProductsExA( const char *product, const char *usersid, DWORD
installed_product, GUID_SIZE, NULL, NULL ); installed_product, GUID_SIZE, NULL, NULL );
if (sid) WideCharToMultiByte( CP_ACP, 0, sidW, *sid_len + 1, sid, *sid_len + 1, NULL, NULL ); if (sid) WideCharToMultiByte( CP_ACP, 0, sidW, *sid_len + 1, sid, *sid_len + 1, NULL, NULL );
} }
msi_free( productW ); free( productW );
msi_free( usersidW ); free( usersidW );
msi_free( sidW ); free( sidW );
return r; return r;
} }
......
...@@ -102,7 +102,7 @@ static ULONG WINAPI MsiActiveScriptSite_Release(IActiveScriptSite* iface) ...@@ -102,7 +102,7 @@ static ULONG WINAPI MsiActiveScriptSite_Release(IActiveScriptSite* iface)
TRACE( "(%p)->(%lu)\n", This, ref ); TRACE( "(%p)->(%lu)\n", This, ref );
if (!ref) if (!ref)
msi_free(This); free(This);
return ref; return ref;
} }
...@@ -254,7 +254,7 @@ static HRESULT create_activescriptsite(MsiActiveScriptSite **obj) ...@@ -254,7 +254,7 @@ static HRESULT create_activescriptsite(MsiActiveScriptSite **obj)
*obj = NULL; *obj = NULL;
object = msi_alloc( sizeof(MsiActiveScriptSite) ); object = malloc(sizeof(MsiActiveScriptSite));
if (!object) if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -344,7 +344,7 @@ static UINT SELECT_delete( struct tagMSIVIEW *view ) ...@@ -344,7 +344,7 @@ static UINT SELECT_delete( struct tagMSIVIEW *view )
sv->table->ops->delete( sv->table ); sv->table->ops->delete( sv->table );
sv->table = NULL; sv->table = NULL;
msi_free( sv ); free( sv );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -430,7 +430,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, ...@@ -430,7 +430,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
count = select_count_columns( columns ); count = select_count_columns( columns );
sv = msi_alloc_zero( FIELD_OFFSET( MSISELECTVIEW, cols[count] )); sv = calloc( 1, offsetof( MSISELECTVIEW, cols[count] ) );
if( !sv ) if( !sv )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -452,7 +452,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, ...@@ -452,7 +452,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
if( r == ERROR_SUCCESS ) if( r == ERROR_SUCCESS )
*view = &sv->view; *view = &sv->view;
else else
msi_free( sv ); free( sv );
return r; return r;
} }
...@@ -162,10 +162,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksA( const char *szProductCodeOrPatchCode, ...@@ -162,10 +162,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksA( const char *szProductCodeOrPatchCode,
/* FIXME: add tests for an invalid format */ /* FIXME: add tests for an invalid format */
if (pcchVolumeLabel) if (pcchVolumeLabel)
volume = msi_alloc(*pcchVolumeLabel * sizeof(WCHAR)); volume = malloc(*pcchVolumeLabel * sizeof(WCHAR));
if (pcchDiskPrompt) if (pcchDiskPrompt)
prompt = msi_alloc(*pcchDiskPrompt * sizeof(WCHAR)); prompt = malloc(*pcchDiskPrompt * sizeof(WCHAR));
if (volume) *volume = '\0'; if (volume) *volume = '\0';
if (prompt) *prompt = '\0'; if (prompt) *prompt = '\0';
...@@ -184,10 +184,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksA( const char *szProductCodeOrPatchCode, ...@@ -184,10 +184,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksA( const char *szProductCodeOrPatchCode,
*pcchDiskPrompt + 1, NULL, NULL); *pcchDiskPrompt + 1, NULL, NULL);
done: done:
msi_free(product); free(product);
msi_free(usersid); free(usersid);
msi_free(volume); free(volume);
msi_free(prompt); free(prompt);
return r; return r;
} }
...@@ -249,8 +249,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW( const WCHAR *szProductCodeOrPatchCode, ...@@ -249,8 +249,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW( const WCHAR *szProductCodeOrPatchCode,
goto done; goto done;
} }
value = msi_alloc(++valuesz * sizeof(WCHAR)); value = malloc(++valuesz * sizeof(WCHAR));
data = msi_alloc(++datasz * sizeof(WCHAR)); data = malloc(++datasz * sizeof(WCHAR));
if (!value || !data) if (!value || !data)
{ {
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
...@@ -316,8 +316,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW( const WCHAR *szProductCodeOrPatchCode, ...@@ -316,8 +316,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW( const WCHAR *szProductCodeOrPatchCode,
index++; index++;
done: done:
msi_free(value); free(value);
msi_free(data); free(data);
RegCloseKey(source); RegCloseKey(source);
return r; return r;
...@@ -355,7 +355,7 @@ UINT WINAPI MsiSourceListEnumSourcesA( const char *szProductCodeOrPatch, const c ...@@ -355,7 +355,7 @@ UINT WINAPI MsiSourceListEnumSourcesA( const char *szProductCodeOrPatch, const c
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto done; goto done;
source = msi_alloc(++len * sizeof(WCHAR)); source = malloc(++len * sizeof(WCHAR));
if (!source) if (!source)
{ {
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
...@@ -378,9 +378,9 @@ UINT WINAPI MsiSourceListEnumSourcesA( const char *szProductCodeOrPatch, const c ...@@ -378,9 +378,9 @@ UINT WINAPI MsiSourceListEnumSourcesA( const char *szProductCodeOrPatch, const c
*pcchSource = len - 1; *pcchSource = len - 1;
done: done:
msi_free(product); free(product);
msi_free(usersid); free(usersid);
msi_free(source); free(source);
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
...@@ -491,7 +491,7 @@ UINT WINAPI MsiSourceListGetInfoA( LPCSTR szProduct, LPCSTR szUserSid, ...@@ -491,7 +491,7 @@ UINT WINAPI MsiSourceListGetInfoA( LPCSTR szProduct, LPCSTR szUserSid,
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
goto done; goto done;
value = msi_alloc(++len * sizeof(WCHAR)); value = malloc(++len * sizeof(WCHAR));
if (!value) if (!value)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
...@@ -510,10 +510,10 @@ UINT WINAPI MsiSourceListGetInfoA( LPCSTR szProduct, LPCSTR szUserSid, ...@@ -510,10 +510,10 @@ UINT WINAPI MsiSourceListGetInfoA( LPCSTR szProduct, LPCSTR szUserSid,
*pcchValue = len - 1; *pcchValue = len - 1;
done: done:
msi_free(product); free(product);
msi_free(usersid); free(usersid);
msi_free(property); free(property);
msi_free(value); free(value);
return ret; return ret;
} }
...@@ -583,13 +583,13 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, ...@@ -583,13 +583,13 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
goto output_out; goto output_out;
} }
source = msi_alloc(size); source = malloc(size);
RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW, RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW,
0, 0, (LPBYTE)source, &size); 0, 0, (LPBYTE)source, &size);
if (!*source) if (!*source)
{ {
msi_free(source); free(source);
RegCloseKey(sourcekey); RegCloseKey(sourcekey);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -598,7 +598,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, ...@@ -598,7 +598,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
{ {
if (*source != 'n' && *source != 'u' && *source != 'm') if (*source != 'n' && *source != 'u' && *source != 'm')
{ {
msi_free(source); free(source);
RegCloseKey(sourcekey); RegCloseKey(sourcekey);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -624,7 +624,7 @@ output_out: ...@@ -624,7 +624,7 @@ output_out:
} }
*pcchValue = lstrlenW(ptr); *pcchValue = lstrlenW(ptr);
msi_free(source); free(source);
} }
else if (!wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW )) else if (!wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW ))
{ {
...@@ -675,10 +675,10 @@ UINT WINAPI MsiSourceListSetInfoA(LPCSTR szProduct, LPCSTR szUserSid, ...@@ -675,10 +675,10 @@ UINT WINAPI MsiSourceListSetInfoA(LPCSTR szProduct, LPCSTR szUserSid,
ret = MsiSourceListSetInfoW(product, usersid, dwContext, dwOptions, ret = MsiSourceListSetInfoW(product, usersid, dwContext, dwOptions,
property, value); property, value);
msi_free(product); free(product);
msi_free(usersid); free(usersid);
msi_free(property); free(property);
msi_free(value); free(value);
return ret; return ret;
} }
...@@ -720,14 +720,14 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, ...@@ -720,14 +720,14 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
} }
size = lstrlenW(L"%c;%d;%s") + lstrlenW(value) + 7; size = lstrlenW(L"%c;%d;%s") + lstrlenW(value) + 7;
buffer = msi_alloc(size * sizeof(WCHAR)); buffer = malloc(size * sizeof(WCHAR));
if (!buffer) if (!buffer)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
r = OpenSourceKey(product, &source, MSICODE_PRODUCT, context, FALSE); r = OpenSourceKey(product, &source, MSICODE_PRODUCT, context, FALSE);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
msi_free(buffer); free(buffer);
return r; return r;
} }
...@@ -736,7 +736,7 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, ...@@ -736,7 +736,7 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
size = (lstrlenW(buffer) + 1) * sizeof(WCHAR); size = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
r = RegSetValueExW(source, INSTALLPROPERTY_LASTUSEDSOURCEW, 0, r = RegSetValueExW(source, INSTALLPROPERTY_LASTUSEDSOURCEW, 0,
REG_SZ, (LPBYTE)buffer, size); REG_SZ, (LPBYTE)buffer, size);
msi_free(buffer); free(buffer);
RegCloseKey(source); RegCloseKey(source);
return r; return r;
...@@ -851,12 +851,12 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName, ...@@ -851,12 +851,12 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
{ {
if (LookupAccountNameW(NULL, szUserName, NULL, &sidsize, NULL, &domsize, NULL)) if (LookupAccountNameW(NULL, szUserName, NULL, &sidsize, NULL, &domsize, NULL))
{ {
PSID psid = msi_alloc(sidsize); PSID psid = malloc(sidsize);
if (LookupAccountNameW(NULL, szUserName, psid, &sidsize, NULL, &domsize, NULL)) if (LookupAccountNameW(NULL, szUserName, psid, &sidsize, NULL, &domsize, NULL))
ConvertSidToStringSidW(psid, &sidstr); ConvertSidToStringSidW(psid, &sidstr);
msi_free(psid); free(psid);
} }
r = MSIREG_OpenProductKey(szProduct, NULL, r = MSIREG_OpenProductKey(szProduct, NULL,
...@@ -903,9 +903,9 @@ UINT WINAPI MsiSourceListAddSourceA( LPCSTR szProduct, LPCSTR szUserName, ...@@ -903,9 +903,9 @@ UINT WINAPI MsiSourceListAddSourceA( LPCSTR szProduct, LPCSTR szUserName,
ret = MsiSourceListAddSourceW(szwproduct, szwusername, dwReserved, szwsource); ret = MsiSourceListAddSourceW(szwproduct, szwusername, dwReserved, szwsource);
msi_free(szwproduct); free(szwproduct);
msi_free(szwusername); free(szwusername);
msi_free(szwsource); free(szwsource);
return ret; return ret;
} }
...@@ -926,9 +926,9 @@ UINT WINAPI MsiSourceListAddSourceExA(LPCSTR szProduct, LPCSTR szUserSid, ...@@ -926,9 +926,9 @@ UINT WINAPI MsiSourceListAddSourceExA(LPCSTR szProduct, LPCSTR szUserSid,
ret = MsiSourceListAddSourceExW(product, usersid, dwContext, ret = MsiSourceListAddSourceExW(product, usersid, dwContext,
dwOptions, source, dwIndex); dwOptions, source, dwIndex);
msi_free(product); free(product);
msi_free(usersid); free(usersid);
msi_free(source); free(source);
return ret; return ret;
} }
...@@ -939,8 +939,8 @@ static void free_source_list(struct list *sourcelist) ...@@ -939,8 +939,8 @@ static void free_source_list(struct list *sourcelist)
{ {
media_info *info = LIST_ENTRY(list_head(sourcelist), media_info, entry); media_info *info = LIST_ENTRY(list_head(sourcelist), media_info, entry);
list_remove(&info->entry); list_remove(&info->entry);
msi_free(info->path); free(info->path);
msi_free(info); free(info);
} }
} }
...@@ -994,14 +994,14 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou ...@@ -994,14 +994,14 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return r; return r;
entry = msi_alloc(sizeof(media_info)); entry = malloc(sizeof(media_info));
if (!entry) if (!entry)
goto error; goto error;
entry->path = msi_alloc(val_size); entry->path = malloc(val_size);
if (!entry->path) if (!entry->path)
{ {
msi_free(entry); free(entry);
goto error; goto error;
} }
...@@ -1013,8 +1013,8 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou ...@@ -1013,8 +1013,8 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou
NULL, (LPBYTE)entry->path, &val_size); NULL, (LPBYTE)entry->path, &val_size);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
msi_free(entry->path); free(entry->path);
msi_free(entry); free(entry);
goto error; goto error;
} }
...@@ -1092,7 +1092,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs ...@@ -1092,7 +1092,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs
else else
{ {
size = lstrlenW(szSource) + 2; size = lstrlenW(szSource) + 2;
source = msi_alloc(size * sizeof(WCHAR)); source = malloc(size * sizeof(WCHAR));
lstrcpyW(source, szSource); lstrcpyW(source, szSource);
lstrcatW(source, postfix); lstrcatW(source, postfix);
} }
...@@ -1118,7 +1118,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs ...@@ -1118,7 +1118,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs
else else
{ {
swprintf(name, ARRAY_SIZE(name), L"%d", dwIndex); swprintf(name, ARRAY_SIZE(name), L"%d", dwIndex);
info = msi_alloc(sizeof(media_info)); info = malloc(sizeof(media_info));
if (!info) if (!info)
{ {
rc = ERROR_OUTOFMEMORY; rc = ERROR_OUTOFMEMORY;
...@@ -1145,7 +1145,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs ...@@ -1145,7 +1145,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs
done: done:
free_source_list(&sourcelist); free_source_list(&sourcelist);
msi_free(source); free(source);
RegCloseKey(typekey); RegCloseKey(typekey);
RegCloseKey(sourcekey); RegCloseKey(sourcekey);
return rc; return rc;
...@@ -1172,10 +1172,10 @@ UINT WINAPI MsiSourceListAddMediaDiskA(LPCSTR szProduct, LPCSTR szUserSid, ...@@ -1172,10 +1172,10 @@ UINT WINAPI MsiSourceListAddMediaDiskA(LPCSTR szProduct, LPCSTR szUserSid,
r = MsiSourceListAddMediaDiskW(product, usersid, dwContext, dwOptions, r = MsiSourceListAddMediaDiskW(product, usersid, dwContext, dwOptions,
dwDiskId, volume, prompt); dwDiskId, volume, prompt);
msi_free(product); free(product);
msi_free(usersid); free(usersid);
msi_free(volume); free(volume);
msi_free(prompt); free(prompt);
return r; return r;
} }
...@@ -1226,7 +1226,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW( const WCHAR *szProduct, const WCHAR *szU ...@@ -1226,7 +1226,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW( const WCHAR *szProduct, const WCHAR *szU
if (szDiskPrompt) size += lstrlenW(szDiskPrompt); if (szDiskPrompt) size += lstrlenW(szDiskPrompt);
size *= sizeof(WCHAR); size *= sizeof(WCHAR);
buffer = msi_alloc(size); buffer = malloc(size);
*buffer = '\0'; *buffer = '\0';
if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel); if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel);
...@@ -1234,7 +1234,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW( const WCHAR *szProduct, const WCHAR *szU ...@@ -1234,7 +1234,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW( const WCHAR *szProduct, const WCHAR *szU
if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt); if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt);
RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size); RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size);
msi_free(buffer); free(buffer);
RegCloseKey(sourcekey); RegCloseKey(sourcekey);
RegCloseKey(mediakey); RegCloseKey(mediakey);
......
...@@ -759,7 +759,7 @@ static void *parser_alloc( void *info, unsigned int sz ) ...@@ -759,7 +759,7 @@ static void *parser_alloc( void *info, unsigned int sz )
SQL_input* sql = (SQL_input*) info; SQL_input* sql = (SQL_input*) info;
struct list *mem; struct list *mem;
mem = msi_alloc( sizeof (struct list) + sz ); mem = malloc( sizeof (struct list) + sz );
list_add_tail( sql->mem, mem ); list_add_tail( sql->mem, mem );
return &mem[1]; return &mem[1];
} }
......
...@@ -61,7 +61,7 @@ static BOOL storages_set_table_size(MSISTORAGESVIEW *sv, UINT size) ...@@ -61,7 +61,7 @@ static BOOL storages_set_table_size(MSISTORAGESVIEW *sv, UINT size)
if (size >= sv->max_storages) if (size >= sv->max_storages)
{ {
sv->max_storages *= 2; sv->max_storages *= 2;
sv->storages = msi_realloc(sv->storages, sv->max_storages * sizeof(*sv->storages)); sv->storages = realloc(sv->storages, sv->max_storages * sizeof(*sv->storages));
if (!sv->storages) if (!sv->storages)
return FALSE; return FALSE;
} }
...@@ -124,7 +124,7 @@ static HRESULT stream_to_storage(IStream *stm, IStorage **stg) ...@@ -124,7 +124,7 @@ static HRESULT stream_to_storage(IStream *stm, IStorage **stg)
} }
size = stat.cbSize.QuadPart; size = stat.cbSize.QuadPart;
data = msi_alloc(size); data = malloc(size);
if (!data) if (!data)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -148,7 +148,7 @@ static HRESULT stream_to_storage(IStream *stm, IStorage **stg) ...@@ -148,7 +148,7 @@ static HRESULT stream_to_storage(IStream *stm, IStorage **stg)
goto done; goto done;
done: done:
msi_free(data); free(data);
if (lockbytes) ILockBytes_Release(lockbytes); if (lockbytes) ILockBytes_Release(lockbytes);
return hr; return hr;
} }
...@@ -248,7 +248,7 @@ static UINT STORAGES_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, ...@@ -248,7 +248,7 @@ static UINT STORAGES_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec,
if (prev) IStorage_Release(prev); if (prev) IStorage_Release(prev);
done: done:
msi_free(name); free(name);
if (substg) IStorage_Release(substg); if (substg) IStorage_Release(substg);
IStorage_Release(stg); IStorage_Release(stg);
...@@ -431,9 +431,9 @@ static UINT STORAGES_delete(struct tagMSIVIEW *view) ...@@ -431,9 +431,9 @@ static UINT STORAGES_delete(struct tagMSIVIEW *view)
IStorage_Release(sv->storages[i].storage); IStorage_Release(sv->storages[i].storage);
} }
msi_free(sv->storages); free(sv->storages);
sv->storages = NULL; sv->storages = NULL;
msi_free(sv); free(sv);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -474,7 +474,7 @@ static INT add_storages_to_table(MSISTORAGESVIEW *sv) ...@@ -474,7 +474,7 @@ static INT add_storages_to_table(MSISTORAGESVIEW *sv)
return -1; return -1;
sv->max_storages = 1; sv->max_storages = 1;
sv->storages = msi_alloc(sizeof(*sv->storages)); sv->storages = malloc(sizeof(*sv->storages));
if (!sv->storages) if (!sv->storages)
return -1; return -1;
...@@ -519,7 +519,7 @@ UINT STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view) ...@@ -519,7 +519,7 @@ UINT STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view)
TRACE("(%p, %p)\n", db, view); TRACE("(%p, %p)\n", db, view);
sv = msi_alloc_zero( sizeof(MSISTORAGESVIEW) ); sv = calloc(1, sizeof(MSISTORAGESVIEW));
if (!sv) if (!sv)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -529,7 +529,7 @@ UINT STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view) ...@@ -529,7 +529,7 @@ UINT STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view)
rows = add_storages_to_table(sv); rows = add_storages_to_table(sv);
if (rows < 0) if (rows < 0)
{ {
msi_free( sv ); free(sv);
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
sv->num_rows = rows; sv->num_rows = rows;
......
...@@ -49,7 +49,7 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size ) ...@@ -49,7 +49,7 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size )
{ {
if (!db->num_streams_allocated) if (!db->num_streams_allocated)
{ {
if (!(db->streams = msi_alloc_zero( size * sizeof(MSISTREAM) ))) return FALSE; if (!(db->streams = calloc( size, sizeof(MSISTREAM) ))) return FALSE;
db->num_streams_allocated = size; db->num_streams_allocated = size;
return TRUE; return TRUE;
} }
...@@ -57,7 +57,7 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size ) ...@@ -57,7 +57,7 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size )
{ {
MSISTREAM *tmp; MSISTREAM *tmp;
UINT new_size = db->num_streams_allocated * 2; UINT new_size = db->num_streams_allocated * 2;
if (!(tmp = msi_realloc( db->streams, new_size * sizeof(*tmp) ))) return FALSE; if (!(tmp = realloc( db->streams, new_size * sizeof(*tmp) ))) return FALSE;
memset( tmp + db->num_streams_allocated, 0, (new_size - db->num_streams_allocated) * sizeof(*tmp) ); memset( tmp + db->num_streams_allocated, 0, (new_size - db->num_streams_allocated) * sizeof(*tmp) );
db->streams = tmp; db->streams = tmp;
db->num_streams_allocated = new_size; db->num_streams_allocated = new_size;
...@@ -238,7 +238,7 @@ static UINT STREAMS_delete_row(struct tagMSIVIEW *view, UINT row) ...@@ -238,7 +238,7 @@ static UINT STREAMS_delete_row(struct tagMSIVIEW *view, UINT row)
db->num_streams = num_rows; db->num_streams = num_rows;
hr = IStorage_DestroyElement( db->storage, encname ); hr = IStorage_DestroyElement( db->storage, encname );
msi_free( encname ); free( encname );
return FAILED( hr ) ? ERROR_FUNCTION_FAILED : ERROR_SUCCESS; return FAILED( hr ) ? ERROR_FUNCTION_FAILED : ERROR_SUCCESS;
} }
...@@ -366,7 +366,7 @@ static UINT STREAMS_delete(struct tagMSIVIEW *view) ...@@ -366,7 +366,7 @@ static UINT STREAMS_delete(struct tagMSIVIEW *view)
TRACE("(%p)\n", view); TRACE("(%p)\n", view);
msi_free(sv); free(sv);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -521,7 +521,7 @@ UINT msi_get_stream( MSIDATABASE *db, const WCHAR *name, IStream **ret ) ...@@ -521,7 +521,7 @@ UINT msi_get_stream( MSIDATABASE *db, const WCHAR *name, IStream **ret )
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
hr = open_stream( db, encname, ret ); hr = open_stream( db, encname, ret );
msi_free( encname ); free( encname );
if (FAILED( hr )) if (FAILED( hr ))
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -547,7 +547,7 @@ UINT STREAMS_CreateView(MSIDATABASE *db, MSIVIEW **view) ...@@ -547,7 +547,7 @@ UINT STREAMS_CreateView(MSIDATABASE *db, MSIVIEW **view)
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return r; return r;
if (!(sv = msi_alloc_zero( sizeof(MSISTREAMSVIEW) ))) if (!(sv = calloc( 1, sizeof(MSISTREAMSVIEW) )))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
sv->view.ops = &streams_ops; sv->view.ops = &streams_ops;
...@@ -629,7 +629,7 @@ UINT msi_commit_streams( MSIDATABASE *db ) ...@@ -629,7 +629,7 @@ UINT msi_commit_streams( MSIDATABASE *db )
if (FAILED( hr )) if (FAILED( hr ))
{ {
ERR( "failed to write stream %s (hr = %#lx)\n", debugstr_w(encname), hr ); ERR( "failed to write stream %s (hr = %#lx)\n", debugstr_w(encname), hr );
msi_free( encname ); free( encname );
IStream_Release( stream ); IStream_Release( stream );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
...@@ -638,17 +638,17 @@ UINT msi_commit_streams( MSIDATABASE *db ) ...@@ -638,17 +638,17 @@ UINT msi_commit_streams( MSIDATABASE *db )
if (FAILED( hr )) if (FAILED( hr ))
{ {
ERR( "failed to commit stream %s (hr = %#lx)\n", debugstr_w(encname), hr ); ERR( "failed to commit stream %s (hr = %#lx)\n", debugstr_w(encname), hr );
msi_free( encname ); free( encname );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
} }
else if (hr != STG_E_FILEALREADYEXISTS) else if (hr != STG_E_FILEALREADYEXISTS)
{ {
ERR( "failed to create stream %s (hr = %#lx)\n", debugstr_w(encname), hr ); ERR( "failed to create stream %s (hr = %#lx)\n", debugstr_w(encname), hr );
msi_free( encname ); free( encname );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
msi_free( encname ); free( encname );
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
......
...@@ -75,24 +75,24 @@ static string_table *init_stringtable( int entries, UINT codepage ) ...@@ -75,24 +75,24 @@ static string_table *init_stringtable( int entries, UINT codepage )
if (!validate_codepage( codepage )) if (!validate_codepage( codepage ))
return NULL; return NULL;
st = msi_alloc( sizeof (string_table) ); st = malloc( sizeof(string_table) );
if( !st ) if( !st )
return NULL; return NULL;
if( entries < 1 ) if( entries < 1 )
entries = 1; entries = 1;
st->strings = msi_alloc_zero( sizeof(struct msistring) * entries ); st->strings = calloc( entries, sizeof(struct msistring) );
if( !st->strings ) if( !st->strings )
{ {
msi_free( st ); free( st );
return NULL; return NULL;
} }
st->sorted = msi_alloc( sizeof (UINT) * entries ); st->sorted = malloc( sizeof(UINT) * entries );
if( !st->sorted ) if( !st->sorted )
{ {
msi_free( st->strings ); free( st->strings );
msi_free( st ); free( st );
return NULL; return NULL;
} }
...@@ -112,11 +112,11 @@ VOID msi_destroy_stringtable( string_table *st ) ...@@ -112,11 +112,11 @@ VOID msi_destroy_stringtable( string_table *st )
{ {
if( st->strings[i].persistent_refcount || if( st->strings[i].persistent_refcount ||
st->strings[i].nonpersistent_refcount ) st->strings[i].nonpersistent_refcount )
msi_free( st->strings[i].data ); free( st->strings[i].data );
} }
msi_free( st->strings ); free( st->strings );
msi_free( st->sorted ); free( st->sorted );
msi_free( st ); free( st );
} }
static int st_find_free_entry( string_table *st ) static int st_find_free_entry( string_table *st )
...@@ -140,12 +140,12 @@ static int st_find_free_entry( string_table *st ) ...@@ -140,12 +140,12 @@ static int st_find_free_entry( string_table *st )
/* dynamically resize */ /* dynamically resize */
sz = st->maxcount + 1 + st->maxcount / 2; sz = st->maxcount + 1 + st->maxcount / 2;
if (!(p = msi_realloc( st->strings, sz * sizeof(*p) ))) return -1; if (!(p = realloc( st->strings, sz * sizeof(*p) ))) return -1;
memset( p + st->maxcount, 0, (sz - st->maxcount) * sizeof(*p) ); memset( p + st->maxcount, 0, (sz - st->maxcount) * sizeof(*p) );
if (!(s = msi_realloc( st->sorted, sz * sizeof(*s) ))) if (!(s = realloc( st->sorted, sz * sizeof(*s) )))
{ {
msi_free( p ); free( p );
return -1; return -1;
} }
...@@ -244,13 +244,13 @@ static UINT string2id( const string_table *st, const char *buffer, UINT *id ) ...@@ -244,13 +244,13 @@ static UINT string2id( const string_table *st, const char *buffer, UINT *id )
if (!(sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 ))) if (!(sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 )))
return r; return r;
str = msi_alloc( sz*sizeof(WCHAR) ); str = malloc( sz * sizeof(WCHAR) );
if( !str ) if( !str )
return ERROR_NOT_ENOUGH_MEMORY; return ERROR_NOT_ENOUGH_MEMORY;
MultiByteToWideChar( st->codepage, 0, buffer, -1, str, sz ); MultiByteToWideChar( st->codepage, 0, buffer, -1, str, sz );
r = msi_string2id( st, str, sz - 1, id ); r = msi_string2id( st, str, sz - 1, id );
msi_free( str ); free( str );
return r; return r;
} }
...@@ -290,7 +290,7 @@ static int add_string( string_table *st, UINT n, const char *data, UINT len, USH ...@@ -290,7 +290,7 @@ static int add_string( string_table *st, UINT n, const char *data, UINT len, USH
/* allocate a new string */ /* allocate a new string */
sz = MultiByteToWideChar( st->codepage, 0, data, len, NULL, 0 ); sz = MultiByteToWideChar( st->codepage, 0, data, len, NULL, 0 );
str = msi_alloc( (sz+1)*sizeof(WCHAR) ); str = malloc( (sz + 1) * sizeof(WCHAR) );
if( !str ) if( !str )
return -1; return -1;
MultiByteToWideChar( st->codepage, 0, data, len, str, sz ); MultiByteToWideChar( st->codepage, 0, data, len, str, sz );
...@@ -329,7 +329,7 @@ int msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persisten ...@@ -329,7 +329,7 @@ int msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persisten
/* allocate a new string */ /* allocate a new string */
TRACE( "%s, n = %d len = %d\n", debugstr_wn(data, len), n, len ); TRACE( "%s, n = %d len = %d\n", debugstr_wn(data, len), n, len );
str = msi_alloc( (len+1)*sizeof(WCHAR) ); str = malloc( (len + 1) * sizeof(WCHAR) );
if( !str ) if( !str )
return -1; return -1;
memcpy( str, data, len*sizeof(WCHAR) ); memcpy( str, data, len*sizeof(WCHAR) );
...@@ -555,8 +555,8 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref ) ...@@ -555,8 +555,8 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref )
TRACE( "loaded %lu strings\n", count ); TRACE( "loaded %lu strings\n", count );
end: end:
msi_free( pool ); free( pool );
msi_free( data ); free( data );
return st; return st;
} }
...@@ -575,13 +575,13 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt ...@@ -575,13 +575,13 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt
TRACE("%u %u %u\n", st->maxcount, datasize, poolsize ); TRACE("%u %u %u\n", st->maxcount, datasize, poolsize );
pool = msi_alloc( poolsize ); pool = malloc( poolsize );
if( ! pool ) if( ! pool )
{ {
WARN("Failed to alloc pool %d bytes\n", poolsize ); WARN("Failed to alloc pool %d bytes\n", poolsize );
goto err; goto err;
} }
data = msi_alloc( datasize ); data = malloc( datasize );
if( ! data ) if( ! data )
{ {
WARN("Failed to alloc data %d bytes\n", datasize ); WARN("Failed to alloc data %d bytes\n", datasize );
...@@ -662,8 +662,8 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt ...@@ -662,8 +662,8 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt
ret = ERROR_SUCCESS; ret = ERROR_SUCCESS;
err: err:
msi_free( data ); free( data );
msi_free( pool ); free( pool );
return ret; return ret;
} }
......
...@@ -91,7 +91,7 @@ static HRESULT (WINAPI *pPropVariantChangeType) ...@@ -91,7 +91,7 @@ static HRESULT (WINAPI *pPropVariantChangeType)
static void free_prop( PROPVARIANT *prop ) static void free_prop( PROPVARIANT *prop )
{ {
if (prop->vt == VT_LPSTR ) if (prop->vt == VT_LPSTR )
msi_free( prop->pszVal ); free( prop->pszVal );
prop->vt = VT_EMPTY; prop->vt = VT_EMPTY;
} }
...@@ -210,7 +210,7 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz ...@@ -210,7 +210,7 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz
property.vt = propdata->type; property.vt = propdata->type;
if( propdata->type == VT_LPSTR ) if( propdata->type == VT_LPSTR )
{ {
LPSTR str = msi_alloc( propdata->u.str.len ); char *str = malloc( propdata->u.str.len );
memcpy( str, propdata->u.str.str, propdata->u.str.len ); memcpy( str, propdata->u.str.str, propdata->u.str.len );
str[ propdata->u.str.len - 1 ] = 0; str[ propdata->u.str.len - 1 ] = 0;
property.pszVal = str; property.pszVal = str;
...@@ -286,7 +286,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm ) ...@@ -286,7 +286,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
data = msi_alloc( section_hdr.cbSection); data = malloc( section_hdr.cbSection );
if( !data ) if( !data )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -300,7 +300,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm ) ...@@ -300,7 +300,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm )
else else
ERR( "failed to read properties %lu %lu\n", count, sz ); ERR( "failed to read properties %lu %lu\n", count, sz );
msi_free( data ); free( data );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -406,7 +406,7 @@ static UINT save_summary_info( const MSISUMMARYINFO * si, IStream *stm ) ...@@ -406,7 +406,7 @@ static UINT save_summary_info( const MSISUMMARYINFO * si, IStream *stm )
section_hdr.cbSection += sz; section_hdr.cbSection += sz;
} }
data = msi_alloc_zero( section_hdr.cbSection ); data = calloc( 1, section_hdr.cbSection );
sz = 0; sz = 0;
memcpy( &data[sz], &section_hdr, sizeof section_hdr ); memcpy( &data[sz], &section_hdr, sizeof section_hdr );
...@@ -420,7 +420,7 @@ static UINT save_summary_info( const MSISUMMARYINFO * si, IStream *stm ) ...@@ -420,7 +420,7 @@ static UINT save_summary_info( const MSISUMMARYINFO * si, IStream *stm )
sz += write_property_to_data( &si->property[i], &data[sz] ); sz += write_property_to_data( &si->property[i], &data[sz] );
r = IStream_Write( stm, data, sz, &count ); r = IStream_Write( stm, data, sz, &count );
msi_free( data ); free( data );
if( FAILED(r) || count != sz ) if( FAILED(r) || count != sz )
return ret; return ret;
...@@ -585,7 +585,7 @@ UINT WINAPI MsiGetSummaryInformationA( MSIHANDLE hDatabase, const char *szDataba ...@@ -585,7 +585,7 @@ UINT WINAPI MsiGetSummaryInformationA( MSIHANDLE hDatabase, const char *szDataba
ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, pHandle); ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, pHandle);
msi_free( szwDatabase ); free( szwDatabase );
return ret; return ret;
} }
...@@ -859,14 +859,14 @@ static UINT set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT type, ...@@ -859,14 +859,14 @@ static UINT set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT type,
{ {
len = WideCharToMultiByte( CP_ACP, 0, str->str.w, -1, len = WideCharToMultiByte( CP_ACP, 0, str->str.w, -1,
NULL, 0, NULL, NULL ); NULL, 0, NULL, NULL );
prop->pszVal = msi_alloc( len ); prop->pszVal = malloc( len );
WideCharToMultiByte( CP_ACP, 0, str->str.w, -1, WideCharToMultiByte( CP_ACP, 0, str->str.w, -1,
prop->pszVal, len, NULL, NULL ); prop->pszVal, len, NULL, NULL );
} }
else else
{ {
len = lstrlenA( str->str.a ) + 1; len = lstrlenA( str->str.a ) + 1;
prop->pszVal = msi_alloc( len ); prop->pszVal = malloc( len );
lstrcpyA( prop->pszVal, str->str.a ); lstrcpyA( prop->pszVal, str->str.a );
} }
break; break;
...@@ -1126,21 +1126,21 @@ static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row ) ...@@ -1126,21 +1126,21 @@ static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row )
break; break;
case VT_LPSTR: case VT_LPSTR:
len++; len++;
if (!(str.str.a = msi_alloc( len ))) if (!(str.str.a = malloc( len )))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
r = get_prop( si, row, NULL, NULL, NULL, &str, &len ); r = get_prop( si, row, NULL, NULL, NULL, &str, &len );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
msi_free( str.str.a ); free( str.str.a );
return r; return r;
} }
sz = len; sz = len;
if (!WriteFile( handle, str.str.a, sz, &sz, NULL )) if (!WriteFile( handle, str.str.a, sz, &sz, NULL ))
{ {
msi_free( str.str.a ); free( str.str.a );
return ERROR_WRITE_FAULT; return ERROR_WRITE_FAULT;
} }
msi_free( str.str.a ); free( str.str.a );
break; break;
case VT_FILETIME: case VT_FILETIME:
if (!FileTimeToSystemTime( &file_time, &system_time )) if (!FileTimeToSystemTime( &file_time, &system_time ))
...@@ -1227,7 +1227,7 @@ UINT WINAPI MsiCreateTransformSummaryInfoA( MSIHANDLE db, MSIHANDLE db_ref, cons ...@@ -1227,7 +1227,7 @@ UINT WINAPI MsiCreateTransformSummaryInfoA( MSIHANDLE db, MSIHANDLE db_ref, cons
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
r = MsiCreateTransformSummaryInfoW( db, db_ref, transformW, error, validation ); r = MsiCreateTransformSummaryInfoW( db, db_ref, transformW, error, validation );
msi_free( transformW ); free( transformW );
return r; return r;
} }
...@@ -1270,19 +1270,19 @@ UINT msi_load_suminfo_properties( MSIPACKAGE *package ) ...@@ -1270,19 +1270,19 @@ UINT msi_load_suminfo_properties( MSIPACKAGE *package )
} }
len++; len++;
if (!(package_code = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; if (!(package_code = malloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
str.str.w = package_code; str.str.w = package_code;
r = get_prop( si, PID_REVNUMBER, NULL, NULL, NULL, &str, &len ); r = get_prop( si, PID_REVNUMBER, NULL, NULL, NULL, &str, &len );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
msi_free( package_code ); free( package_code );
msiobj_release( &si->hdr ); msiobj_release( &si->hdr );
return r; return r;
} }
r = msi_set_property( package->db, L"PackageCode", package_code, len ); r = msi_set_property( package->db, L"PackageCode", package_code, len );
msi_free( package_code ); free( package_code );
count = 0; count = 0;
get_prop( si, PID_WORDCOUNT, NULL, &count, NULL, NULL, NULL ); get_prop( si, PID_WORDCOUNT, NULL, &count, NULL, NULL, NULL );
......
...@@ -190,7 +190,7 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view ) ...@@ -190,7 +190,7 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view )
if( wv ) if( wv )
wv->ops->delete( wv ); wv->ops->delete( wv );
msiobj_release( &uv->db->hdr ); msiobj_release( &uv->db->hdr );
msi_free( uv ); free( uv );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -242,7 +242,7 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table, ...@@ -242,7 +242,7 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
return r; return r;
} }
uv = msi_alloc_zero( sizeof *uv ); uv = calloc( 1, sizeof *uv );
if( !uv ) if( !uv )
{ {
wv->ops->delete( wv ); wv->ops->delete( wv );
......
...@@ -87,13 +87,13 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c ...@@ -87,13 +87,13 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c
if (find_product( prop, product )) if (find_product( prop, product ))
{ {
TRACE( "related product property %s already contains %s\n", debugstr_w(action_prop), debugstr_w(product) ); TRACE( "related product property %s already contains %s\n", debugstr_w(action_prop), debugstr_w(product) );
msi_free( prop ); free( prop );
return; return;
} }
if (prop) len += lstrlenW( prop ); if (prop) len += lstrlenW( prop );
len += lstrlenW( product ) + 2; len += lstrlenW( product ) + 2;
if (!(newprop = msi_alloc( len * sizeof(WCHAR) ))) return; if (!(newprop = malloc( len * sizeof(WCHAR) ))) return;
if (prop) if (prop)
{ {
lstrcpyW( newprop, prop ); lstrcpyW( newprop, prop );
...@@ -108,8 +108,8 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c ...@@ -108,8 +108,8 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c
TRACE( "related product property %s now %s\n", debugstr_w(action_prop), debugstr_w(newprop) ); TRACE( "related product property %s now %s\n", debugstr_w(action_prop), debugstr_w(newprop) );
msi_free( prop ); free( prop );
msi_free( newprop ); free( newprop );
} }
static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param) static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
......
...@@ -90,9 +90,9 @@ static void free_reorder(MSIWHEREVIEW *wv) ...@@ -90,9 +90,9 @@ static void free_reorder(MSIWHEREVIEW *wv)
return; return;
for (i = 0; i < wv->row_count; i++) for (i = 0; i < wv->row_count; i++)
msi_free(wv->reorder[i]); free(wv->reorder[i]);
msi_free( wv->reorder ); free(wv->reorder);
wv->reorder = NULL; wv->reorder = NULL;
wv->reorder_size = 0; wv->reorder_size = 0;
wv->row_count = 0; wv->row_count = 0;
...@@ -100,7 +100,7 @@ static void free_reorder(MSIWHEREVIEW *wv) ...@@ -100,7 +100,7 @@ static void free_reorder(MSIWHEREVIEW *wv)
static UINT init_reorder(MSIWHEREVIEW *wv) static UINT init_reorder(MSIWHEREVIEW *wv)
{ {
MSIROWENTRY **new = msi_alloc_zero(sizeof(MSIROWENTRY *) * INITIAL_REORDER_SIZE); MSIROWENTRY **new = calloc(INITIAL_REORDER_SIZE, sizeof(MSIROWENTRY *));
if (!new) if (!new)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
...@@ -131,7 +131,7 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[]) ...@@ -131,7 +131,7 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[])
MSIROWENTRY **new_reorder; MSIROWENTRY **new_reorder;
UINT newsize = wv->reorder_size * 2; UINT newsize = wv->reorder_size * 2;
new_reorder = msi_realloc(wv->reorder, newsize * sizeof(*new_reorder)); new_reorder = realloc(wv->reorder, newsize * sizeof(*new_reorder));
if (!new_reorder) if (!new_reorder)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
memset(new_reorder + wv->reorder_size, 0, (newsize - wv->reorder_size) * sizeof(*new_reorder)); memset(new_reorder + wv->reorder_size, 0, (newsize - wv->reorder_size) * sizeof(*new_reorder));
...@@ -140,7 +140,7 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[]) ...@@ -140,7 +140,7 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[])
wv->reorder_size = newsize; wv->reorder_size = newsize;
} }
new = msi_alloc(FIELD_OFFSET( MSIROWENTRY, values[wv->table_count] )); new = malloc(offsetof(MSIROWENTRY, values[wv->table_count]));
if (!new) if (!new)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
...@@ -792,7 +792,7 @@ static JOINTABLE **ordertables( MSIWHEREVIEW *wv ) ...@@ -792,7 +792,7 @@ static JOINTABLE **ordertables( MSIWHEREVIEW *wv )
JOINTABLE *table; JOINTABLE *table;
JOINTABLE **tables; JOINTABLE **tables;
tables = msi_alloc_zero( (wv->table_count + 1) * sizeof(*tables) ); tables = calloc(wv->table_count + 1, sizeof(*tables));
if (wv->cond) if (wv->cond)
{ {
...@@ -848,7 +848,7 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) ...@@ -848,7 +848,7 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
ordered_tables = ordertables( wv ); ordered_tables = ordertables( wv );
rows = msi_alloc( wv->table_count * sizeof(*rows) ); rows = malloc(wv->table_count * sizeof(*rows));
for (i = 0; i < wv->table_count; i++) for (i = 0; i < wv->table_count; i++)
rows[i] = INVALID_ROW_INDEX; rows[i] = INVALID_ROW_INDEX;
...@@ -862,8 +862,8 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) ...@@ -862,8 +862,8 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if (wv->order_info) if (wv->order_info)
r = wv->order_info->error; r = wv->order_info->error;
msi_free( rows ); free(rows);
msi_free( ordered_tables ); free(ordered_tables);
return r; return r;
} }
...@@ -1046,7 +1046,7 @@ static UINT WHERE_delete( struct tagMSIVIEW *view ) ...@@ -1046,7 +1046,7 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
table->view->ops->delete(table->view); table->view->ops->delete(table->view);
table->view = NULL; table->view = NULL;
next = table->next; next = table->next;
msi_free(table); free(table);
table = next; table = next;
} }
wv->tables = NULL; wv->tables = NULL;
...@@ -1054,11 +1054,11 @@ static UINT WHERE_delete( struct tagMSIVIEW *view ) ...@@ -1054,11 +1054,11 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
free_reorder(wv); free_reorder(wv);
msi_free(wv->order_info); free(wv->order_info);
wv->order_info = NULL; wv->order_info = NULL;
msiobj_release( &wv->db->hdr ); msiobj_release( &wv->db->hdr );
msi_free( wv ); free(wv);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -1086,7 +1086,7 @@ static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns) ...@@ -1086,7 +1086,7 @@ static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns)
if (count == 0) if (count == 0)
return ERROR_SUCCESS; return ERROR_SUCCESS;
orderinfo = msi_alloc(FIELD_OFFSET(MSIORDERINFO, columns[count])); orderinfo = malloc(offsetof(MSIORDERINFO, columns[count]));
if (!orderinfo) if (!orderinfo)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
...@@ -1108,7 +1108,7 @@ static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns) ...@@ -1108,7 +1108,7 @@ static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns)
return ERROR_SUCCESS; return ERROR_SUCCESS;
error: error:
msi_free(orderinfo); free(orderinfo);
return r; return r;
} }
...@@ -1233,7 +1233,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, ...@@ -1233,7 +1233,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
TRACE("(%s)\n", debugstr_w(tables) ); TRACE("(%s)\n", debugstr_w(tables) );
wv = msi_alloc_zero( sizeof *wv ); wv = calloc(1, sizeof *wv);
if( !wv ) if( !wv )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -1250,7 +1250,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, ...@@ -1250,7 +1250,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
if ((ptr = wcschr(tables, ' '))) if ((ptr = wcschr(tables, ' ')))
*ptr = '\0'; *ptr = '\0';
table = msi_alloc(sizeof(JOINTABLE)); table = malloc(sizeof(JOINTABLE));
if (!table) if (!table)
{ {
r = ERROR_OUTOFMEMORY; r = ERROR_OUTOFMEMORY;
...@@ -1261,7 +1261,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, ...@@ -1261,7 +1261,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
WARN("can't create table: %s\n", debugstr_w(tables)); WARN("can't create table: %s\n", debugstr_w(tables));
msi_free(table); free(table);
r = ERROR_BAD_QUERY_SYNTAX; r = ERROR_BAD_QUERY_SYNTAX;
goto end; goto end;
} }
...@@ -1272,7 +1272,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, ...@@ -1272,7 +1272,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
{ {
ERR("can't get table dimensions\n"); ERR("can't get table dimensions\n");
table->view->ops->delete(table->view); table->view->ops->delete(table->view);
msi_free(table); free(table);
goto end; goto end;
} }
......
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