Commit 16fab1a4 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

ieframe: Use standard C functions for memory allocation.

parent 0d294ad2
......@@ -269,7 +269,7 @@ static void ready_state_task_destr(task_header_t *_task)
ready_state_task_t *task = (ready_state_task_t*)_task;
IUnknown_Release(task->doc);
heap_free(task);
free(task);
}
static void ready_state_proc(DocHost *This, task_header_t *_task)
......@@ -282,7 +282,7 @@ static void ready_state_proc(DocHost *This, task_header_t *_task)
static void push_ready_state_task(DocHost *This, READYSTATE ready_state)
{
ready_state_task_t *task = heap_alloc(sizeof(ready_state_task_t));
ready_state_task_t *task = malloc(sizeof(ready_state_task_t));
IUnknown_AddRef(This->document);
task->doc = This->document;
......@@ -293,7 +293,7 @@ static void push_ready_state_task(DocHost *This, READYSTATE ready_state)
static void object_available_task_destr(task_header_t *task)
{
heap_free(task);
free(task);
}
static void object_available_proc(DocHost *This, task_header_t *task)
......@@ -331,7 +331,7 @@ HRESULT dochost_object_available(DocHost *This, IUnknown *doc)
/* FIXME: Call SetAdvise */
task = heap_alloc(sizeof(*task));
task = malloc(sizeof(*task));
push_dochost_task(This, task, object_available_proc, object_available_task_destr, FALSE);
hres = get_doc_ready_state(This, &ready_state);
......@@ -388,7 +388,7 @@ static void free_travellog_entry(travellog_entry_t *entry)
IStream_Release(entry->stream);
entry->stream = NULL;
}
heap_free(entry->url);
free(entry->url);
entry->url = NULL;
}
......@@ -436,7 +436,7 @@ static void update_travellog(DocHost *This)
}
if(!This->travellog.log) {
This->travellog.log = heap_alloc(4 * sizeof(*This->travellog.log));
This->travellog.log = malloc(4 * sizeof(*This->travellog.log));
if(!This->travellog.log)
return;
......@@ -444,7 +444,7 @@ static void update_travellog(DocHost *This)
}else if(This->travellog.size < This->travellog.position+1) {
travellog_entry_t *new_travellog;
new_travellog = heap_realloc(This->travellog.log, This->travellog.size*2*sizeof(*This->travellog.log));
new_travellog = realloc(This->travellog.log, This->travellog.size * 2 * sizeof(*This->travellog.log));
if(!new_travellog)
return;
......@@ -460,7 +460,7 @@ static void update_travellog(DocHost *This)
new_entry = This->travellog.log + This->travellog.position;
new_entry->url = heap_strdupW(This->url);
new_entry->url = wcsdup(This->url);
TRACE("Adding %s at %d\n", debugstr_w(This->url), This->travellog.position);
if(!new_entry->url)
return;
......@@ -1169,7 +1169,7 @@ void DocHost_Release(DocHost *This)
while(This->travellog.length)
free_travellog_entry(This->travellog.log + --This->travellog.length);
heap_free(This->travellog.log);
free(This->travellog.log);
heap_free(This->url);
free(This->url);
}
......@@ -181,7 +181,7 @@ static ULONG WINAPI EnumConnections_Release(IEnumConnections *iface)
if(!ref) {
IConnectionPoint_Release(&This->cp->IConnectionPoint_iface);
heap_free(This);
free(This);
}
return ref;
......@@ -324,10 +324,9 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
}
if(i == This->sinks_size)
This->sinks = heap_realloc(This->sinks,
(++This->sinks_size)*sizeof(*This->sinks));
This->sinks = realloc(This->sinks, (++This->sinks_size) * sizeof(*This->sinks));
}else {
This->sinks = heap_alloc(sizeof(*This->sinks));
This->sinks = malloc(sizeof(*This->sinks));
This->sinks_size = 1;
i = 0;
}
......@@ -361,7 +360,7 @@ static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
TRACE("(%p)->(%p)\n", This, ppEnum);
ret = heap_alloc(sizeof(*ret));
ret = malloc(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
......@@ -402,7 +401,7 @@ void call_sink(ConnectionPoint *This, DISPID dispid, DISPPARAMS *dispparams)
static void ConnectionPoint_Create(REFIID riid, ConnectionPoint **cp,
IConnectionPointContainer *container)
{
ConnectionPoint *ret = heap_alloc(sizeof(ConnectionPoint));
ConnectionPoint *ret = malloc(sizeof(ConnectionPoint));
ret->IConnectionPoint_iface.lpVtbl = &ConnectionPointVtbl;
......@@ -424,8 +423,8 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This)
IDispatch_Release(This->sinks[i]);
}
heap_free(This->sinks);
heap_free(This);
free(This->sinks);
free(This);
}
void ConnectionPointContainer_Init(ConnectionPointContainer *This, IUnknown *impl)
......
......@@ -92,7 +92,7 @@ static ULONG WINAPI InternetExplorer_Release(IWebBrowser2 *iface)
if(This->frame_hwnd)
DestroyWindow(This->frame_hwnd);
list_remove(&This->entry);
heap_free(This);
free(This);
released_obj();
}
......
......@@ -37,7 +37,6 @@
#include "shdeprecated.h"
#include "docobjectservice.h"
#include "wine/heap.h"
#include "wine/list.h"
typedef struct ConnectionPoint ConnectionPoint;
......@@ -340,22 +339,6 @@ static inline void unlock_module(void) {
InterlockedDecrement(&module_ref);
}
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
LPWSTR ret = NULL;
if(str) {
DWORD size;
size = (lstrlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);
}
return ret;
}
static inline LPWSTR co_strdupW(LPCWSTR str)
{
WCHAR *ret = CoTaskMemAlloc((lstrlenW(str) + 1)*sizeof(WCHAR));
......
......@@ -116,7 +116,7 @@ static void free_fav_menu_data(HMENU menu)
int i;
for(i = 0; (url = get_fav_url_from_id(menu, ID_BROWSE_GOTOFAV_FIRST + i)); i++)
heap_free( url );
free( url );
}
static int get_menu_item_count(HMENU menu)
......@@ -152,7 +152,7 @@ static void add_fav_to_menu(HMENU favmenu, HMENU menu, LPWSTR title, LPCWSTR url
return;
}
urlbuf = heap_alloc((lstrlenW(url) + 1) * sizeof(WCHAR));
urlbuf = malloc((wcslen(url) + 1) * sizeof(WCHAR));
if(!urlbuf)
return;
......@@ -801,7 +801,7 @@ static HRESULT create_ie(InternetExplorer **ret_obj)
{
InternetExplorer *ret;
ret = heap_alloc_zero(sizeof(InternetExplorer));
ret = calloc(1, sizeof(InternetExplorer));
if(!ret)
return E_OUTOFMEMORY;
......@@ -888,7 +888,7 @@ static ULONG WINAPI InternetExplorerManager_Release(IInternetExplorerManager *if
if (ref == 0)
{
HeapFree(GetProcessHeap(), 0, This);
free(This);
released_obj();
}
......@@ -917,7 +917,7 @@ HRESULT WINAPI InternetExplorerManager_Create(IClassFactory *iface, IUnknown *pO
TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
if (!(ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret))))
if (!(ret = calloc(1, sizeof(*ret))))
return E_OUTOFMEMORY;
ret->IInternetExplorerManager_iface.lpVtbl = &InternetExplorerManager_vtbl;
......@@ -1057,19 +1057,19 @@ static HDDEDATA WINAPI dde_proc(UINT type, UINT uFmt, HCONV hConv, HSZ hsz1, HSZ
break;
}
url = heap_alloc(size);
url = malloc(size);
if(!url)
break;
if(DdeGetData(data, (BYTE*)url, size, 0) != size) {
ERR("error during read\n");
heap_free(url);
free(url);
break;
}
ret = open_dde_url(url);
heap_free(url);
free(url);
return ret;
}
......
......@@ -97,7 +97,7 @@ static BOOL run_winemenubuilder( const WCHAR *args )
lstrcatW( app, menubuilder );
len = (lstrlenW( app ) + lstrlenW( args ) + 1) * sizeof(WCHAR);
buffer = heap_alloc( len );
buffer = malloc( len );
if( !buffer )
return FALSE;
......@@ -113,7 +113,7 @@ static BOOL run_winemenubuilder( const WCHAR *args )
ret = CreateProcessW( app, buffer, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi );
Wow64RevertWow64FsRedirection( redir );
heap_free( buffer );
free( buffer );
if (ret)
{
......@@ -132,13 +132,13 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink )
BOOL ret;
len = sizeof(szFormat) + lstrlenW( szLink ) * sizeof(WCHAR);
buffer = heap_alloc( len );
buffer = malloc( len );
if( !buffer )
return FALSE;
swprintf( buffer, len / sizeof(WCHAR), szFormat, szLink );
ret = run_winemenubuilder( buffer );
heap_free( buffer );
free( buffer );
return ret;
}
......@@ -193,7 +193,7 @@ static ULONG Unknown_Release(InternetShortcut *This)
CoTaskMemFree(This->url);
CoTaskMemFree(This->currentFile);
IPropertySetStorage_Release(This->property_set_storage);
heap_free(This);
free(This);
unlock_module();
}
return count;
......@@ -374,13 +374,13 @@ static HRESULT WINAPI UniformResourceLocatorA_InvokeCommand(IUniformResourceLoca
wideCommandInfo.hwndParent = pCommandInfo->hwndParent;
len = MultiByteToWideChar(CP_ACP, 0, pCommandInfo->pcszVerb, -1, NULL, 0);
wideVerb = heap_alloc(len * sizeof(WCHAR));
wideVerb = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pCommandInfo->pcszVerb, -1, wideVerb, len);
wideCommandInfo.pcszVerb = wideVerb;
res = UniformResourceLocatorW_InvokeCommand(&This->IUniformResourceLocatorW_iface, &wideCommandInfo);
heap_free(wideVerb);
free(wideVerb);
return res;
}
......@@ -565,7 +565,7 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *pFile, LPCOLESTR pszFileNam
* An ASCII (probably UTF8?) value in "URL=..."
*/
len = WideCharToMultiByte(CP_UTF8, 0, This->url, -1, NULL, 0, 0, 0);
url = heap_alloc(len);
url = malloc(len);
if (url != NULL)
{
HANDLE file;
......@@ -607,14 +607,14 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *pFile, LPCOLESTR pszFileNam
{
char indexString[50];
len = WideCharToMultiByte(CP_UTF8, 0, pvread[0].pwszVal, -1, NULL, 0, 0, 0);
iconfile = heap_alloc(len);
iconfile = malloc(len);
if (iconfile != NULL)
{
WideCharToMultiByte(CP_UTF8, 0, pvread[0].pwszVal, -1, iconfile, len, 0, 0);
WriteFile(file, str_ICONFILE, lstrlenA(str_ICONFILE), &bytesWritten, NULL);
WriteFile(file, iconfile, lstrlenA(iconfile), &bytesWritten, NULL);
WriteFile(file, str_eol, lstrlenA(str_eol), &bytesWritten, NULL);
heap_free(iconfile);
free(iconfile);
}
sprintf(indexString, "ICONINDEX=%d", pvread[1].iVal);
......@@ -642,7 +642,7 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *pFile, LPCOLESTR pszFileNam
}
else
hr = E_FAIL;
heap_free(url);
free(url);
}
else
hr = E_OUTOFMEMORY;
......@@ -793,7 +793,7 @@ static InternetShortcut *create_shortcut(void)
{
InternetShortcut *newshortcut;
newshortcut = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InternetShortcut));
newshortcut = calloc(1, sizeof(InternetShortcut));
if (newshortcut)
{
HRESULT hr;
......@@ -809,7 +809,7 @@ static InternetShortcut *create_shortcut(void)
if (FAILED(hr))
{
TRACE("Failed to create the storage object needed for the shortcut.\n");
heap_free(newshortcut);
free(newshortcut);
return NULL;
}
......@@ -818,7 +818,7 @@ static InternetShortcut *create_shortcut(void)
{
TRACE("Failed to create the property object needed for the shortcut.\n");
IPropertySetStorage_Release(newshortcut->property_set_storage);
heap_free(newshortcut);
free(newshortcut);
return NULL;
}
IPropertyStorage_Release(dummy);
......@@ -864,7 +864,7 @@ void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd)
return;
len = MultiByteToWideChar(CP_ACP, 0, lpcstrUrl, -1, NULL, 0);
urlfilepath = heap_alloc(len * sizeof(WCHAR));
urlfilepath = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpcstrUrl, -1, urlfilepath, len);
if(SUCCEEDED(IPersistFile_Load(&shortcut->IPersistFile_iface, urlfilepath, 0))) {
......@@ -879,6 +879,6 @@ void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd)
TRACE("failed to open URL: %s\n", debugstr_a(lpcstrUrl));
}
heap_free(urlfilepath);
free(urlfilepath);
Unknown_Release(shortcut);
}
......@@ -132,14 +132,14 @@ HRESULT set_dochost_url(DocHost *This, const WCHAR *url)
WCHAR *new_url;
if(url) {
new_url = heap_strdupW(url);
new_url = wcsdup(url);
if(!new_url)
return E_OUTOFMEMORY;
}else {
new_url = NULL;
}
heap_free(This->url);
free(This->url);
This->url = new_url;
This->container_vtbl->set_url(This, This->url);
......@@ -215,7 +215,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
GlobalFree(This->post_data);
SysFreeString(This->headers);
SysFreeString(This->url);
heap_free(This);
free(This);
}
return ref;
......@@ -546,7 +546,7 @@ static const IHttpSecurityVtbl HttpSecurityVtbl = {
static BindStatusCallback *create_callback(DocHost *doc_host, LPCWSTR url, PBYTE post_data,
ULONG post_data_len, LPCWSTR headers)
{
BindStatusCallback *ret = heap_alloc(sizeof(BindStatusCallback));
BindStatusCallback *ret = malloc(sizeof(BindStatusCallback));
ret->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
ret->IHttpNegotiate_iface.lpVtbl = &HttpNegotiateVtbl;
......@@ -780,7 +780,7 @@ static void doc_navigate_task_destr(task_header_t *t)
SysFreeString(task->headers);
if(task->post_data)
SafeArrayDestroy(task->post_data);
heap_free(task);
free(task);
}
static void doc_navigate_proc(DocHost *This, task_header_t *t)
......@@ -819,7 +819,7 @@ static HRESULT async_doc_navigate(DocHost *This, LPCWSTR url, LPCWSTR headers, P
TRACE("%s\n", debugstr_w(url));
task = heap_alloc_zero(sizeof(*task));
task = calloc(1, sizeof(*task));
if(!task)
return E_OUTOFMEMORY;
......@@ -920,7 +920,7 @@ static void navigate_bsc_task_destr(task_header_t *t)
task_navigate_bsc_t *task = (task_navigate_bsc_t*)t;
IBindStatusCallback_Release(&task->bsc->IBindStatusCallback_iface);
heap_free(task);
free(task);
}
static void navigate_bsc_proc(DocHost *This, task_header_t *t)
......@@ -993,7 +993,7 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
}else {
task_navigate_bsc_t *task;
task = heap_alloc(sizeof(*task));
task = malloc(sizeof(*task));
task->bsc = create_callback(This, url, post_data, post_data_len, headers);
push_dochost_task(This, &task->header, navigate_bsc_proc, navigate_bsc_task_destr, This->url == NULL);
}
......
......@@ -374,7 +374,7 @@ static ULONG WINAPI EnumOLEVERB_Release(IEnumOLEVERB *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
heap_free(This);
free(This);
return ref;
}
......@@ -718,7 +718,7 @@ static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEn
TRACE("(%p)->(%p)\n", This, ppEnumOleVerb);
ret = heap_alloc(sizeof(*ret));
ret = malloc(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
......
......@@ -83,7 +83,7 @@ static ULONG WINAPI ShellBrowser_Release(IShellBrowser* iface)
if(!ref) {
assert(!This->doc_host);
heap_free(This);
free(This);
}
return ref;
......@@ -922,7 +922,7 @@ HRESULT create_browser_service(DocHost *doc_host, ShellBrowser **ret)
{
ShellBrowser *sb;
sb = heap_alloc(sizeof(ShellBrowser));
sb = malloc(sizeof(ShellBrowser));
if(!sb)
return E_OUTOFMEMORY;
......
......@@ -76,7 +76,7 @@ static ULONG WINAPI ShellUIHelper2_Release(IShellUIHelper2 *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref)
heap_free(This);
free(This);
return ref;
}
......@@ -370,7 +370,7 @@ HRESULT create_shell_ui_helper(IShellUIHelper2 **_ret)
{
ShellUIHelper *ret;
ret = heap_alloc(sizeof(*ret));
ret = malloc(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
......
......@@ -180,7 +180,7 @@ static ULONG WINAPI WebBrowser_Release(IUnknown *iface)
WebBrowser_OleObject_Destroy(This);
heap_free(This);
free(This);
unlock_module();
}
......@@ -1287,7 +1287,7 @@ static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void
if (outer && !IsEqualIID(riid, &IID_IUnknown))
return CLASS_E_NOAGGREGATION;
ret = heap_alloc_zero(sizeof(WebBrowser));
ret = calloc(1, sizeof(WebBrowser));
ret->IUnknown_inner.lpVtbl = &internal_unk_vtbl;
ret->IWebBrowser2_iface.lpVtbl = &WebBrowser2Vtbl;
......
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