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