Commit 68684365 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

sxs: Use CRT memory allocation functions.

parent 6341e6d9
......@@ -106,19 +106,19 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
*/
static void FreeAppInfo(APPINFO *info)
{
HeapFree(GetProcessHeap(), 0, info->title);
HeapFree(GetProcessHeap(), 0, info->path);
HeapFree(GetProcessHeap(), 0, info->path_modify);
HeapFree(GetProcessHeap(), 0, info->icon);
HeapFree(GetProcessHeap(), 0, info->publisher);
HeapFree(GetProcessHeap(), 0, info->version);
HeapFree(GetProcessHeap(), 0, info->contact);
HeapFree(GetProcessHeap(), 0, info->helplink);
HeapFree(GetProcessHeap(), 0, info->helptelephone);
HeapFree(GetProcessHeap(), 0, info->readme);
HeapFree(GetProcessHeap(), 0, info->urlupdateinfo);
HeapFree(GetProcessHeap(), 0, info->comments);
HeapFree(GetProcessHeap(), 0, info);
free(info->title);
free(info->path);
free(info->path_modify);
free(info->icon);
free(info->publisher);
free(info->version);
free(info->contact);
free(info->helplink);
free(info->helptelephone);
free(info->readme);
free(info->urlupdateinfo);
free(info->comments);
free(info);
}
static WCHAR *get_reg_str(HKEY hkey, const WCHAR *value)
......@@ -127,7 +127,7 @@ static WCHAR *get_reg_str(HKEY hkey, const WCHAR *value)
WCHAR *ret = NULL;
if (!RegQueryValueExW(hkey, value, NULL, &type, NULL, &len) && type == REG_SZ)
{
if (!(ret = HeapAlloc(GetProcessHeap(), 0, len))) return NULL;
if (!(ret = malloc(len))) return NULL;
RegQueryValueExW(hkey, value, 0, 0, (BYTE *)ret, &len);
}
return ret;
......@@ -176,12 +176,12 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
{
int len = lstrlenW(L"msiexec /x%s") + lstrlenW(subKeyName);
if (!(command = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) goto err;
if (!(command = malloc(len * sizeof(WCHAR)))) goto err;
wsprintfW(command, L"msiexec /x%s", subKeyName);
}
else if (!RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, NULL, &uninstlen))
{
if (!(command = HeapAlloc(GetProcessHeap(), 0, uninstlen))) goto err;
if (!(command = malloc(uninstlen))) goto err;
RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, (BYTE *)command, &uninstlen);
}
else
......@@ -191,10 +191,10 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
continue;
}
info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct APPINFO));
info = calloc(1, sizeof(*info));
if (!info) goto err;
info->title = HeapAlloc(GetProcessHeap(), 0, displen);
info->title = malloc(displen);
if (!info->title)
goto err;
......@@ -209,7 +209,7 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
info->icon = 0;
else
{
info->icon = HeapAlloc(GetProcessHeap(), 0, displen);
info->icon = malloc(displen);
if (!info->icon)
goto err;
......@@ -259,12 +259,12 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
{
int len = lstrlenW(L"msiexec /i%s") + lstrlenW(subKeyName);
if (!(info->path_modify = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) goto err;
if (!(info->path_modify = malloc(len * sizeof(WCHAR)))) goto err;
wsprintfW(info->path_modify, L"msiexec /i%s", subKeyName);
}
else if (!RegQueryValueExW(hkeyApp, L"ModifyPath", 0, 0, NULL, &displen))
{
if (!(info->path_modify = HeapAlloc(GetProcessHeap(), 0, displen))) goto err;
if (!(info->path_modify = malloc(displen))) goto err;
RegQueryValueExW(hkeyApp, L"ModifyPath", 0, 0, (BYTE *)info->path_modify, &displen);
}
}
......@@ -286,7 +286,7 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
err:
RegCloseKey(hkeyApp);
if (info) FreeAppInfo(info);
HeapFree(GetProcessHeap(), 0, command);
free(command);
return FALSE;
}
......
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