Commit 80175e41 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

urlmon: Use standard C functions for memory allocation.

parent 534b977c
...@@ -57,8 +57,8 @@ static void release_install_ctx(install_ctx_t *ctx) ...@@ -57,8 +57,8 @@ static void release_install_ctx(install_ctx_t *ctx)
IUri_Release(ctx->uri); IUri_Release(ctx->uri);
if(ctx->callback) if(ctx->callback)
IBindStatusCallback_Release(ctx->callback); IBindStatusCallback_Release(ctx->callback);
heap_free(ctx->install_file); free(ctx->install_file);
heap_free(ctx); free(ctx);
} }
static inline BOOL file_exists(const WCHAR *file_name) static inline BOOL file_exists(const WCHAR *file_name)
...@@ -80,7 +80,7 @@ static HRESULT extract_cab_file(install_ctx_t *ctx) ...@@ -80,7 +80,7 @@ static HRESULT extract_cab_file(install_ctx_t *ctx)
path_len = lstrlenW(ctx->tmp_dir); path_len = lstrlenW(ctx->tmp_dir);
file_len = lstrlenW(ctx->file_name); file_len = lstrlenW(ctx->file_name);
ctx->install_file = heap_alloc((path_len+file_len+2)*sizeof(WCHAR)); ctx->install_file = malloc((path_len + file_len + 2) * sizeof(WCHAR));
if(!ctx->install_file) if(!ctx->install_file)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -192,13 +192,13 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name) ...@@ -192,13 +192,13 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
expand_command(ctx, val, NULL, &size); expand_command(ctx, val, NULL, &size);
cmd = heap_alloc(size*sizeof(WCHAR)); cmd = malloc(size * sizeof(WCHAR));
if(!cmd) if(!cmd)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
expand_command(ctx, val, cmd, &size); expand_command(ctx, val, cmd, &size);
hres = RunSetupCommandW(ctx->hwnd, cmd, NULL, ctx->tmp_dir, NULL, NULL, 0, NULL); hres = RunSetupCommandW(ctx->hwnd, cmd, NULL, ctx->tmp_dir, NULL, NULL, 0, NULL);
heap_free(cmd); free(cmd);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -505,13 +505,13 @@ HRESULT WINAPI AsyncInstallDistributionUnit(const WCHAR *szDistUnit, const WCHAR ...@@ -505,13 +505,13 @@ HRESULT WINAPI AsyncInstallDistributionUnit(const WCHAR *szDistUnit, const WCHAR
if(szDistUnit || szTYPE || szExt) if(szDistUnit || szTYPE || szExt)
FIXME("Unsupported arguments\n"); FIXME("Unsupported arguments\n");
ctx = heap_alloc_zero(sizeof(*ctx)); ctx = calloc(1, sizeof(*ctx));
if(!ctx) if(!ctx)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hres = CreateUri(szURL, 0, 0, &ctx->uri); hres = CreateUri(szURL, 0, 0, &ctx->uri);
if(FAILED(hres)) { if(FAILED(hres)) {
heap_free(ctx); free(ctx);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
......
...@@ -162,7 +162,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallbackEx *iface) ...@@ -162,7 +162,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallbackEx *iface)
if(This->serv_prov) if(This->serv_prov)
IServiceProvider_Release(This->serv_prov); IServiceProvider_Release(This->serv_prov);
IBindStatusCallback_Release(This->callback); IBindStatusCallback_Release(This->callback);
heap_free(This); free(This);
} }
return ref; return ref;
...@@ -579,7 +579,7 @@ HRESULT wrap_callback(IBindStatusCallback *bsc, IBindStatusCallback **ret_iface) ...@@ -579,7 +579,7 @@ HRESULT wrap_callback(IBindStatusCallback *bsc, IBindStatusCallback **ret_iface)
{ {
BindStatusCallback *ret; BindStatusCallback *ret;
ret = heap_alloc_zero(sizeof(BindStatusCallback)); ret = calloc(1, sizeof(BindStatusCallback));
if(!ret) if(!ret)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -751,7 +751,7 @@ static ULONG WINAPI AsyncBindCtx_Release(IBindCtx *iface) ...@@ -751,7 +751,7 @@ static ULONG WINAPI AsyncBindCtx_Release(IBindCtx *iface)
if(!ref) { if(!ref) {
IBindCtx_Release(This->bindctx); IBindCtx_Release(This->bindctx);
heap_free(This); free(This);
} }
return ref; return ref;
...@@ -951,7 +951,7 @@ HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options, ...@@ -951,7 +951,7 @@ HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options,
return hres; return hres;
} }
ret = heap_alloc(sizeof(AsyncBindCtx)); ret = malloc(sizeof(AsyncBindCtx));
ret->IBindCtx_iface.lpVtbl = &AsyncBindCtxVtbl; ret->IBindCtx_iface.lpVtbl = &AsyncBindCtxVtbl;
ret->ref = 1; ret->ref = 1;
......
...@@ -160,8 +160,8 @@ static void dump_BINDINFO(BINDINFO *bi) ...@@ -160,8 +160,8 @@ static void dump_BINDINFO(BINDINFO *bi)
static void mime_available(Binding *This, LPCWSTR mime) static void mime_available(Binding *This, LPCWSTR mime)
{ {
heap_free(This->mime); free(This->mime);
This->mime = heap_strdupW(mime); This->mime = wcsdup(mime);
if(!This->mime || !This->report_mime) if(!This->mime || !This->report_mime)
return; return;
...@@ -199,31 +199,31 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid) ...@@ -199,31 +199,31 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid)
'C','o','n','t','e','n','t',' ','T','y','p','e','\\'}; 'C','o','n','t','e','n','t',' ','T','y','p','e','\\'};
len = lstrlenW(mime)+1; len = lstrlenW(mime)+1;
key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR)); key_name = malloc(sizeof(mime_keyW) + len * sizeof(WCHAR));
memcpy(key_name, mime_keyW, sizeof(mime_keyW)); memcpy(key_name, mime_keyW, sizeof(mime_keyW));
lstrcpyW(key_name + ARRAY_SIZE(mime_keyW), mime); lstrcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey); res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
heap_free(key_name); free(key_name);
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
WARN("Could not open MIME key: %lx\n", res); WARN("Could not open MIME key: %lx\n", res);
return NULL; return NULL;
} }
size = 50*sizeof(WCHAR); size = 50*sizeof(WCHAR);
ret = heap_alloc(size); ret = malloc(size);
res = RegQueryValueExW(hkey, L"CLSID", NULL, &type, (BYTE*)ret, &size); res = RegQueryValueExW(hkey, L"CLSID", NULL, &type, (BYTE*)ret, &size);
RegCloseKey(hkey); RegCloseKey(hkey);
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
WARN("Could not get CLSID: %08lx\n", res); WARN("Could not get CLSID: %08lx\n", res);
heap_free(ret); free(ret);
return NULL; return NULL;
} }
hres = CLSIDFromString(ret, clsid); hres = CLSIDFromString(ret, clsid);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("Could not parse CLSID: %08lx\n", hres); WARN("Could not parse CLSID: %08lx\n", hres);
heap_free(ret); free(ret);
return NULL; return NULL;
} }
...@@ -307,7 +307,7 @@ static void create_object(Binding *binding) ...@@ -307,7 +307,7 @@ static void create_object(Binding *binding)
if(clsid_str) { if(clsid_str) {
hres = create_mime_object(binding, &clsid, clsid_str); hres = create_mime_object(binding, &clsid, clsid_str);
heap_free(clsid_str); free(clsid_str);
}else { }else {
FIXME("Could not find object for MIME %s\n", debugstr_w(binding->mime)); FIXME("Could not find object for MIME %s\n", debugstr_w(binding->mime));
hres = REGDB_E_CLASSNOTREG; hres = REGDB_E_CLASSNOTREG;
...@@ -323,8 +323,8 @@ static void create_object(Binding *binding) ...@@ -323,8 +323,8 @@ static void create_object(Binding *binding)
static void cache_file_available(Binding *This, const WCHAR *file_name) static void cache_file_available(Binding *This, const WCHAR *file_name)
{ {
heap_free(This->stgmed_buf->cache_file); free(This->stgmed_buf->cache_file);
This->stgmed_buf->cache_file = heap_strdupW(file_name); This->stgmed_buf->cache_file = wcsdup(file_name);
if(This->use_cache_file) { if(This->use_cache_file) {
This->stgmed_buf->file = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, This->stgmed_buf->file = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
...@@ -378,8 +378,8 @@ static ULONG WINAPI StgMedUnk_Release(IUnknown *iface) ...@@ -378,8 +378,8 @@ static ULONG WINAPI StgMedUnk_Release(IUnknown *iface)
if(This->file != INVALID_HANDLE_VALUE) if(This->file != INVALID_HANDLE_VALUE)
CloseHandle(This->file); CloseHandle(This->file);
IInternetProtocolEx_Release(This->protocol); IInternetProtocolEx_Release(This->protocol);
heap_free(This->cache_file); free(This->cache_file);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -395,7 +395,7 @@ static const IUnknownVtbl StgMedUnkVtbl = { ...@@ -395,7 +395,7 @@ static const IUnknownVtbl StgMedUnkVtbl = {
static stgmed_buf_t *create_stgmed_buf(IInternetProtocolEx *protocol) static stgmed_buf_t *create_stgmed_buf(IInternetProtocolEx *protocol)
{ {
stgmed_buf_t *ret = heap_alloc(sizeof(*ret)); stgmed_buf_t *ret = malloc(sizeof(*ret));
ret->IUnknown_iface.lpVtbl = &StgMedUnkVtbl; ret->IUnknown_iface.lpVtbl = &StgMedUnkVtbl;
ret->ref = 1; ret->ref = 1;
...@@ -471,7 +471,7 @@ static ULONG WINAPI ProtocolStream_Release(IStream *iface) ...@@ -471,7 +471,7 @@ static ULONG WINAPI ProtocolStream_Release(IStream *iface)
if(!ref) { if(!ref) {
IUnknown_Release(&This->buf->IUnknown_iface); IUnknown_Release(&This->buf->IUnknown_iface);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -701,7 +701,7 @@ typedef struct { ...@@ -701,7 +701,7 @@ typedef struct {
static stgmed_obj_t *create_stgmed_stream(stgmed_buf_t *buf) static stgmed_obj_t *create_stgmed_stream(stgmed_buf_t *buf)
{ {
ProtocolStream *ret = heap_alloc(sizeof(ProtocolStream)); ProtocolStream *ret = malloc(sizeof(ProtocolStream));
ret->stgmed_obj.vtbl = &stgmed_stream_vtbl; ret->stgmed_obj.vtbl = &stgmed_stream_vtbl;
ret->IStream_iface.lpVtbl = &ProtocolStreamVtbl; ret->IStream_iface.lpVtbl = &ProtocolStreamVtbl;
...@@ -720,7 +720,7 @@ static void stgmed_file_release(stgmed_obj_t *obj) ...@@ -720,7 +720,7 @@ static void stgmed_file_release(stgmed_obj_t *obj)
stgmed_file_obj_t *file_obj = (stgmed_file_obj_t*)obj; stgmed_file_obj_t *file_obj = (stgmed_file_obj_t*)obj;
IUnknown_Release(&file_obj->buf->IUnknown_iface); IUnknown_Release(&file_obj->buf->IUnknown_iface);
heap_free(file_obj); free(file_obj);
} }
static HRESULT stgmed_file_fill_stgmed(stgmed_obj_t *obj, STGMEDIUM *stgmed) static HRESULT stgmed_file_fill_stgmed(stgmed_obj_t *obj, STGMEDIUM *stgmed)
...@@ -754,7 +754,7 @@ static const stgmed_obj_vtbl stgmed_file_vtbl = { ...@@ -754,7 +754,7 @@ static const stgmed_obj_vtbl stgmed_file_vtbl = {
static stgmed_obj_t *create_stgmed_file(stgmed_buf_t *buf) static stgmed_obj_t *create_stgmed_file(stgmed_buf_t *buf)
{ {
stgmed_file_obj_t *ret = heap_alloc(sizeof(*ret)); stgmed_file_obj_t *ret = malloc(sizeof(*ret));
ret->stgmed_obj.vtbl = &stgmed_file_vtbl; ret->stgmed_obj.vtbl = &stgmed_file_vtbl;
...@@ -868,9 +868,9 @@ static ULONG WINAPI Binding_Release(IBinding *iface) ...@@ -868,9 +868,9 @@ static ULONG WINAPI Binding_Release(IBinding *iface)
This->section.DebugInfo->Spare[0] = 0; This->section.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->section); DeleteCriticalSection(&This->section);
SysFreeString(This->url); SysFreeString(This->url);
heap_free(This->mime); free(This->mime);
heap_free(This->redirect_url); free(This->redirect_url);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -1036,8 +1036,8 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink ...@@ -1036,8 +1036,8 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink
on_progress(This, 0, 0, BINDSTATUS_CONNECTING, szStatusText); on_progress(This, 0, 0, BINDSTATUS_CONNECTING, szStatusText);
break; break;
case BINDSTATUS_REDIRECTING: case BINDSTATUS_REDIRECTING:
heap_free(This->redirect_url); free(This->redirect_url);
This->redirect_url = heap_strdupW(szStatusText); This->redirect_url = wcsdup(szStatusText);
on_progress(This, 0, 0, BINDSTATUS_REDIRECTING, szStatusText); on_progress(This, 0, 0, BINDSTATUS_REDIRECTING, szStatusText);
break; break;
case BINDSTATUS_BEGINDOWNLOADDATA: case BINDSTATUS_BEGINDOWNLOADDATA:
...@@ -1448,7 +1448,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB ...@@ -1448,7 +1448,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB
URLMON_LockModule(); URLMON_LockModule();
ret = heap_alloc_zero(sizeof(Binding)); ret = calloc(1, sizeof(Binding));
ret->IBinding_iface.lpVtbl = &BindingVtbl; ret->IBinding_iface.lpVtbl = &BindingVtbl;
ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl;
......
...@@ -224,8 +224,8 @@ static void mime_available(BindProtocol *This, LPCWSTR mime, BOOL verified) ...@@ -224,8 +224,8 @@ static void mime_available(BindProtocol *This, LPCWSTR mime, BOOL verified)
IInternetProtocol *mime_filter; IInternetProtocol *mime_filter;
HRESULT hres; HRESULT hres;
heap_free(This->mime); free(This->mime);
This->mime = heap_strdupW(mime); This->mime = wcsdup(mime);
if(This->protocol_handler==&This->default_protocol_handler.IInternetProtocol_iface if(This->protocol_handler==&This->default_protocol_handler.IInternetProtocol_iface
&& (mime_filter = get_mime_filter(mime))) { && (mime_filter = get_mime_filter(mime))) {
...@@ -348,8 +348,8 @@ static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) ...@@ -348,8 +348,8 @@ static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface)
This->section.DebugInfo->Spare[0] = 0; This->section.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->section); DeleteCriticalSection(&This->section);
heap_free(This->mime); free(This->mime);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -670,7 +670,7 @@ static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCO ...@@ -670,7 +670,7 @@ static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCO
hres = IInternetProtocol_Continue(protocol ? protocol : This->protocol, pProtocolData); hres = IInternetProtocol_Continue(protocol ? protocol : This->protocol, pProtocolData);
heap_free(pProtocolData); free(pProtocolData);
if(protocol) if(protocol)
IInternetProtocol_Release(protocol); IInternetProtocol_Release(protocol);
return hres; return hres;
...@@ -754,7 +754,7 @@ static HRESULT WINAPI ProtocolHandler_Read(IInternetProtocol *iface, void *pv, ...@@ -754,7 +754,7 @@ static HRESULT WINAPI ProtocolHandler_Read(IInternetProtocol *iface, void *pv,
memcpy(pv, This->buf, read); memcpy(pv, This->buf, read);
if(read == This->buf_size) { if(read == This->buf_size) {
heap_free(This->buf); free(This->buf);
This->buf = NULL; This->buf = NULL;
}else { }else {
memmove(This->buf, This->buf+cb, This->buf_size-cb); memmove(This->buf, This->buf+cb, This->buf_size-cb);
...@@ -933,13 +933,13 @@ static HRESULT report_data(BindProtocol *This) ...@@ -933,13 +933,13 @@ static HRESULT report_data(BindProtocol *This)
return hres; return hres;
if(!This->buf) { if(!This->buf) {
This->buf = heap_alloc(BUFFER_SIZE); This->buf = malloc(BUFFER_SIZE);
if(!This->buf) if(!This->buf)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}else if(read + This->buf_size > BUFFER_SIZE) { }else if(read + This->buf_size > BUFFER_SIZE) {
BYTE *tmp; BYTE *tmp;
tmp = heap_realloc(This->buf, read+This->buf_size); tmp = realloc(This->buf, read + This->buf_size);
if(!tmp) if(!tmp)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->buf = tmp; This->buf = tmp;
...@@ -969,8 +969,8 @@ static HRESULT report_data(BindProtocol *This) ...@@ -969,8 +969,8 @@ static HRESULT report_data(BindProtocol *This)
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
heap_free(This->mime); free(This->mime);
This->mime = heap_strdupW(mime); This->mime = wcsdup(mime);
CoTaskMemFree(mime); CoTaskMemFree(mime);
This->reported_mime = TRUE; This->reported_mime = TRUE;
if(This->protocol_sink) if(This->protocol_sink)
...@@ -1222,7 +1222,7 @@ static void switch_proc(BindProtocol *bind, task_header_t *t) ...@@ -1222,7 +1222,7 @@ static void switch_proc(BindProtocol *bind, task_header_t *t)
IInternetProtocol_Continue(bind->protocol_handler, task->data); IInternetProtocol_Continue(bind->protocol_handler, task->data);
heap_free(task); free(task);
} }
static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface, static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface,
...@@ -1236,7 +1236,7 @@ static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface ...@@ -1236,7 +1236,7 @@ static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface
TRACE("flags %lx state %lx data %p cb %lu\n", pProtocolData->grfFlags, pProtocolData->dwState, TRACE("flags %lx state %lx data %p cb %lu\n", pProtocolData->grfFlags, pProtocolData->dwState,
pProtocolData->pData, pProtocolData->cbData); pProtocolData->pData, pProtocolData->cbData);
data = heap_alloc(sizeof(PROTOCOLDATA)); data = malloc(sizeof(PROTOCOLDATA));
if(!data) if(!data)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(data, pProtocolData, sizeof(PROTOCOLDATA)); memcpy(data, pProtocolData, sizeof(PROTOCOLDATA));
...@@ -1245,10 +1245,10 @@ static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface ...@@ -1245,10 +1245,10 @@ static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface
|| !do_direct_notif(This)) { || !do_direct_notif(This)) {
switch_task_t *task; switch_task_t *task;
task = heap_alloc(sizeof(switch_task_t)); task = malloc(sizeof(switch_task_t));
if(!task) if(!task)
{ {
heap_free(data); free(data);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -1274,8 +1274,8 @@ static void on_progress_proc(BindProtocol *This, task_header_t *t) ...@@ -1274,8 +1274,8 @@ static void on_progress_proc(BindProtocol *This, task_header_t *t)
IInternetProtocolSink_ReportProgress(This->protocol_sink_handler, task->status_code, task->status_text); IInternetProtocolSink_ReportProgress(This->protocol_sink_handler, task->status_code, task->status_text);
heap_free(task->status_text); free(task->status_text);
heap_free(task); free(task);
} }
static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSink *iface,
...@@ -1290,10 +1290,10 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSin ...@@ -1290,10 +1290,10 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSin
}else { }else {
on_progress_task_t *task; on_progress_task_t *task;
task = heap_alloc(sizeof(on_progress_task_t)); task = malloc(sizeof(on_progress_task_t));
task->status_code = ulStatusCode; task->status_code = ulStatusCode;
task->status_text = heap_strdupW(szStatusText); task->status_text = wcsdup(szStatusText);
push_task(This, &task->header, on_progress_proc); push_task(This, &task->header, on_progress_proc);
} }
...@@ -1315,7 +1315,7 @@ static void report_data_proc(BindProtocol *This, task_header_t *t) ...@@ -1315,7 +1315,7 @@ static void report_data_proc(BindProtocol *This, task_header_t *t)
IInternetProtocolSink_ReportData(This->protocol_sink_handler, IInternetProtocolSink_ReportData(This->protocol_sink_handler,
task->bscf, task->progress, task->progress_max); task->bscf, task->progress, task->progress_max);
heap_free(task); free(task);
} }
static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *iface, static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *iface,
...@@ -1331,7 +1331,7 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *i ...@@ -1331,7 +1331,7 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *i
if(!do_direct_notif(This)) { if(!do_direct_notif(This)) {
report_data_task_t *task; report_data_task_t *task;
task = heap_alloc(sizeof(report_data_task_t)); task = malloc(sizeof(report_data_task_t));
if(!task) if(!task)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1361,8 +1361,8 @@ static void report_result_proc(BindProtocol *This, task_header_t *t) ...@@ -1361,8 +1361,8 @@ static void report_result_proc(BindProtocol *This, task_header_t *t)
IInternetProtocolSink_ReportResult(This->protocol_sink_handler, task->hres, task->err, task->str); IInternetProtocolSink_ReportResult(This->protocol_sink_handler, task->hres, task->err, task->str);
heap_free(task->str); free(task->str);
heap_free(task); free(task);
} }
static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink *iface, static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink *iface,
...@@ -1379,13 +1379,13 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink ...@@ -1379,13 +1379,13 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink
if(!do_direct_notif(This)) { if(!do_direct_notif(This)) {
report_result_task_t *task; report_result_task_t *task;
task = heap_alloc(sizeof(report_result_task_t)); task = malloc(sizeof(report_result_task_t));
if(!task) if(!task)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
task->hres = hrResult; task->hres = hrResult;
task->err = dwError; task->err = dwError;
task->str = heap_strdupW(szResult); task->str = wcsdup(szResult);
push_task(This, &task->header, report_result_proc); push_task(This, &task->header, report_result_proc);
return S_OK; return S_OK;
...@@ -1450,7 +1450,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = { ...@@ -1450,7 +1450,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
HRESULT create_binding_protocol(BindProtocol **protocol) HRESULT create_binding_protocol(BindProtocol **protocol)
{ {
BindProtocol *ret = heap_alloc_zero(sizeof(BindProtocol)); BindProtocol *ret = calloc(1, sizeof(BindProtocol));
ret->IInternetProtocolEx_iface.lpVtbl = &BindProtocolVtbl; ret->IInternetProtocolEx_iface.lpVtbl = &BindProtocolVtbl;
ret->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl; ret->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl;
......
...@@ -96,9 +96,9 @@ static ULONG WINAPI DownloadBSC_Release(IBindStatusCallback *iface) ...@@ -96,9 +96,9 @@ static ULONG WINAPI DownloadBSC_Release(IBindStatusCallback *iface)
IBindStatusCallback_Release(This->callback); IBindStatusCallback_Release(This->callback);
if(This->binding) if(This->binding)
IBinding_Release(This->binding); IBinding_Release(This->binding);
heap_free(This->file_name); free(This->file_name);
heap_free(This->cache_file); free(This->cache_file);
heap_free(This); free(This);
} }
return ref; return ref;
...@@ -176,7 +176,7 @@ static HRESULT WINAPI DownloadBSC_OnProgress(IBindStatusCallback *iface, ULONG u ...@@ -176,7 +176,7 @@ static HRESULT WINAPI DownloadBSC_OnProgress(IBindStatusCallback *iface, ULONG u
case BINDSTATUS_CACHEFILENAMEAVAILABLE: case BINDSTATUS_CACHEFILENAMEAVAILABLE:
hres = on_progress(This, ulProgress, ulProgressMax, ulStatusCode, szStatusText); hres = on_progress(This, ulProgress, ulProgressMax, ulStatusCode, szStatusText);
This->cache_file = heap_strdupW(szStatusText); This->cache_file = wcsdup(szStatusText);
break; break;
case BINDSTATUS_FINDINGRESOURCE: /* FIXME */ case BINDSTATUS_FINDINGRESOURCE: /* FIXME */
...@@ -334,7 +334,7 @@ static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_na ...@@ -334,7 +334,7 @@ static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_na
{ {
DownloadBSC *ret; DownloadBSC *ret;
ret = heap_alloc_zero(sizeof(*ret)); ret = calloc(1, sizeof(*ret));
if(!ret) if(!ret)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -343,9 +343,9 @@ static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_na ...@@ -343,9 +343,9 @@ static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_na
ret->ref = 1; ret->ref = 1;
if(file_name) { if(file_name) {
ret->file_name = heap_strdupW(file_name); ret->file_name = wcsdup(file_name);
if(!ret->file_name) { if(!ret->file_name) {
heap_free(ret); free(ret);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
} }
...@@ -487,13 +487,13 @@ HRESULT WINAPI URLDownloadToFileA(LPUNKNOWN pCaller, LPCSTR szURL, LPCSTR szFile ...@@ -487,13 +487,13 @@ HRESULT WINAPI URLDownloadToFileA(LPUNKNOWN pCaller, LPCSTR szURL, LPCSTR szFile
TRACE("(%p %s %s %ld %p)\n", pCaller, debugstr_a(szURL), debugstr_a(szFileName), dwReserved, lpfnCB); TRACE("(%p %s %s %ld %p)\n", pCaller, debugstr_a(szURL), debugstr_a(szFileName), dwReserved, lpfnCB);
urlW = heap_strdupAtoW(szURL); urlW = strdupAtoW(szURL);
file_nameW = heap_strdupAtoW(szFileName); file_nameW = strdupAtoW(szFileName);
hres = URLDownloadToFileW(pCaller, urlW, file_nameW, dwReserved, lpfnCB); hres = URLDownloadToFileW(pCaller, urlW, file_nameW, dwReserved, lpfnCB);
heap_free(urlW); free(urlW);
heap_free(file_nameW); free(file_nameW);
return hres; return hres;
} }
...@@ -102,7 +102,7 @@ static ULONG WINAPI FileProtocolUnk_Release(IUnknown *iface) ...@@ -102,7 +102,7 @@ static ULONG WINAPI FileProtocolUnk_Release(IUnknown *iface)
if(!ref) { if(!ref) {
if(This->file != INVALID_HANDLE_VALUE) if(This->file != INVALID_HANDLE_VALUE)
CloseHandle(This->file); CloseHandle(This->file);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -425,7 +425,7 @@ HRESULT FileProtocol_Construct(IUnknown *outer, LPVOID *ppobj) ...@@ -425,7 +425,7 @@ HRESULT FileProtocol_Construct(IUnknown *outer, LPVOID *ppobj)
URLMON_LockModule(); URLMON_LockModule();
ret = heap_alloc(sizeof(FileProtocol)); ret = malloc(sizeof(FileProtocol));
ret->IUnknown_inner.lpVtbl = &FileProtocolUnkVtbl; ret->IUnknown_inner.lpVtbl = &FileProtocolUnkVtbl;
ret->IInternetProtocolEx_iface.lpVtbl = &FileProtocolExVtbl; ret->IInternetProtocolEx_iface.lpVtbl = &FileProtocolExVtbl;
......
...@@ -74,8 +74,8 @@ static ULONG WINAPI EnumFORMATETC_Release(IEnumFORMATETC *iface) ...@@ -74,8 +74,8 @@ static ULONG WINAPI EnumFORMATETC_Release(IEnumFORMATETC *iface)
TRACE("(%p) ref=%ld\n", This, ref); TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { if(!ref) {
heap_free(This->fetc); free(This->fetc);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -156,7 +156,7 @@ static const IEnumFORMATETCVtbl EnumFORMATETCVtbl = { ...@@ -156,7 +156,7 @@ static const IEnumFORMATETCVtbl EnumFORMATETCVtbl = {
static IEnumFORMATETC *EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmtetc, UINT it) static IEnumFORMATETC *EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmtetc, UINT it)
{ {
EnumFORMATETC *ret = heap_alloc(sizeof(EnumFORMATETC)); EnumFORMATETC *ret = malloc(sizeof(EnumFORMATETC));
URLMON_LockModule(); URLMON_LockModule();
...@@ -165,7 +165,7 @@ static IEnumFORMATETC *EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmt ...@@ -165,7 +165,7 @@ static IEnumFORMATETC *EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmt
ret->it = it; ret->it = it;
ret->fetc_cnt = cfmtetc; ret->fetc_cnt = cfmtetc;
ret->fetc = heap_alloc(cfmtetc*sizeof(FORMATETC)); ret->fetc = malloc(cfmtetc * sizeof(FORMATETC));
memcpy(ret->fetc, rgfmtetc, cfmtetc*sizeof(FORMATETC)); memcpy(ret->fetc, rgfmtetc, cfmtetc*sizeof(FORMATETC));
return &ret->IEnumFORMATETC_iface; return &ret->IEnumFORMATETC_iface;
......
...@@ -177,7 +177,7 @@ static ULONG WINAPI FtpProtocolUnk_Release(IUnknown *iface) ...@@ -177,7 +177,7 @@ static ULONG WINAPI FtpProtocolUnk_Release(IUnknown *iface)
if(!ref) { if(!ref) {
protocol_close_connection(&This->base); protocol_close_connection(&This->base);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -459,7 +459,7 @@ HRESULT FtpProtocol_Construct(IUnknown *outer, void **ppv) ...@@ -459,7 +459,7 @@ HRESULT FtpProtocol_Construct(IUnknown *outer, void **ppv)
URLMON_LockModule(); URLMON_LockModule();
ret = heap_alloc_zero(sizeof(FtpProtocol)); ret = calloc(1, sizeof(FtpProtocol));
ret->base.vtbl = &AsyncProtocolVtbl; ret->base.vtbl = &AsyncProtocolVtbl;
ret->IUnknown_inner.lpVtbl = &FtpProtocolUnkVtbl; ret->IUnknown_inner.lpVtbl = &FtpProtocolUnkVtbl;
......
...@@ -133,7 +133,7 @@ static ULONG WINAPI GopherProtocol_Release(IInternetProtocol *iface) ...@@ -133,7 +133,7 @@ static ULONG WINAPI GopherProtocol_Release(IInternetProtocol *iface)
TRACE("(%p) ref=%ld\n", This, ref); TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { if(!ref) {
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -317,7 +317,7 @@ HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) ...@@ -317,7 +317,7 @@ HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
URLMON_LockModule(); URLMON_LockModule();
ret = heap_alloc_zero(sizeof(GopherProtocol)); ret = calloc(1, sizeof(GopherProtocol));
ret->base.vtbl = &AsyncProtocolVtbl; ret->base.vtbl = &AsyncProtocolVtbl;
ret->IInternetProtocol_iface.lpVtbl = &GopherProtocolVtbl; ret->IInternetProtocol_iface.lpVtbl = &GopherProtocolVtbl;
......
...@@ -75,12 +75,12 @@ static LPWSTR query_http_info(HttpProtocol *This, DWORD option) ...@@ -75,12 +75,12 @@ static LPWSTR query_http_info(HttpProtocol *This, DWORD option)
res = HttpQueryInfoW(This->base.request, option, NULL, &len, NULL); res = HttpQueryInfoW(This->base.request, option, NULL, &len, NULL);
if (!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { if (!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
ret = heap_alloc(len); ret = malloc(len);
res = HttpQueryInfoW(This->base.request, option, ret, &len, NULL); res = HttpQueryInfoW(This->base.request, option, ret, &len, NULL);
} }
if(!res) { if(!res) {
TRACE("HttpQueryInfoW(%ld) failed: %08lx\n", option, GetLastError()); TRACE("HttpQueryInfoW(%ld) failed: %08lx\n", option, GetLastError());
heap_free(ret); free(ret);
return NULL; return NULL;
} }
...@@ -408,7 +408,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques ...@@ -408,7 +408,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
len = addl_header ? lstrlenW(addl_header) : 0; len = addl_header ? lstrlenW(addl_header) : 0;
This->full_header = heap_alloc(len*sizeof(WCHAR)+sizeof(default_headersW)); This->full_header = malloc(len * sizeof(WCHAR) + sizeof(default_headersW));
if(!This->full_header) { if(!This->full_header) {
IServiceProvider_Release(service_provider); IServiceProvider_Release(service_provider);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -529,7 +529,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) ...@@ -529,7 +529,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
location = query_http_info(This, HTTP_QUERY_LOCATION); location = query_http_info(This, HTTP_QUERY_LOCATION);
This->base.flags |= FLAG_RESULT_REPORTED | FLAG_LAST_DATA_REPORTED; This->base.flags |= FLAG_RESULT_REPORTED | FLAG_LAST_DATA_REPORTED;
IInternetProtocolSink_ReportResult(This->base.protocol_sink, INET_E_REDIRECT_FAILED, 0, location); IInternetProtocolSink_ReportResult(This->base.protocol_sink, INET_E_REDIRECT_FAILED, 0, location);
heap_free(location); free(location);
return INET_E_REDIRECT_FAILED; return INET_E_REDIRECT_FAILED;
} }
...@@ -537,7 +537,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) ...@@ -537,7 +537,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
if(response_headers) { if(response_headers) {
hres = IHttpNegotiate_OnResponse(This->http_negotiate, status_code, response_headers, hres = IHttpNegotiate_OnResponse(This->http_negotiate, status_code, response_headers,
NULL, NULL); NULL, NULL);
heap_free(response_headers); free(response_headers);
if (hres != S_OK) { if (hres != S_OK) {
WARN("IHttpNegotiate_OnResponse failed: %08lx\n", hres); WARN("IHttpNegotiate_OnResponse failed: %08lx\n", hres);
return S_OK; return S_OK;
...@@ -550,7 +550,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) ...@@ -550,7 +550,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
ranges = query_http_info(This, HTTP_QUERY_ACCEPT_RANGES); ranges = query_http_info(This, HTTP_QUERY_ACCEPT_RANGES);
if(ranges) { if(ranges) {
IInternetProtocolSink_ReportProgress(This->base.protocol_sink, BINDSTATUS_ACCEPTRANGES, NULL); IInternetProtocolSink_ReportProgress(This->base.protocol_sink, BINDSTATUS_ACCEPTRANGES, NULL);
heap_free(ranges); free(ranges);
} }
content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE); content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE);
...@@ -563,7 +563,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) ...@@ -563,7 +563,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
(This->base.bindf & BINDF_FROMURLMON) (This->base.bindf & BINDF_FROMURLMON)
? BINDSTATUS_MIMETYPEAVAILABLE : BINDSTATUS_RAWMIMETYPE, ? BINDSTATUS_MIMETYPEAVAILABLE : BINDSTATUS_RAWMIMETYPE,
content_type); content_type);
heap_free(content_type); free(content_type);
}else { }else {
WARN("HttpQueryInfo failed: %ld\n", GetLastError()); WARN("HttpQueryInfo failed: %ld\n", GetLastError());
IInternetProtocolSink_ReportProgress(This->base.protocol_sink, IInternetProtocolSink_ReportProgress(This->base.protocol_sink,
...@@ -574,7 +574,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) ...@@ -574,7 +574,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH); content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH);
if(content_length) { if(content_length) {
This->base.content_length = wcstol(content_length, NULL, 10); This->base.content_length = wcstol(content_length, NULL, 10);
heap_free(content_length); free(content_length);
} }
return S_OK; return S_OK;
...@@ -589,7 +589,7 @@ static void HttpProtocol_close_connection(Protocol *prot) ...@@ -589,7 +589,7 @@ static void HttpProtocol_close_connection(Protocol *prot)
This->http_negotiate = NULL; This->http_negotiate = NULL;
} }
heap_free(This->full_header); free(This->full_header);
This->full_header = NULL; This->full_header = NULL;
} }
...@@ -677,7 +677,7 @@ static ULONG WINAPI HttpProtocolUnk_Release(IUnknown *iface) ...@@ -677,7 +677,7 @@ static ULONG WINAPI HttpProtocolUnk_Release(IUnknown *iface)
if(!ref) { if(!ref) {
protocol_close_connection(&This->base); protocol_close_connection(&This->base);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -956,7 +956,7 @@ static HRESULT create_http_protocol(BOOL https, IUnknown *outer, void **ppobj) ...@@ -956,7 +956,7 @@ static HRESULT create_http_protocol(BOOL https, IUnknown *outer, void **ppobj)
{ {
HttpProtocol *ret; HttpProtocol *ret;
ret = heap_alloc_zero(sizeof(HttpProtocol)); ret = calloc(1, sizeof(HttpProtocol));
if(!ret) if(!ret)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -77,7 +77,7 @@ static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface) ...@@ -77,7 +77,7 @@ static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface)
TRACE("(%p) ref=%ld\n", This, ref); TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { if(!ref) {
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -251,7 +251,7 @@ HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) ...@@ -251,7 +251,7 @@ HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
URLMON_LockModule(); URLMON_LockModule();
ret = heap_alloc_zero(sizeof(MimeFilter)); ret = calloc(1, sizeof(MimeFilter));
ret->IInternetProtocol_iface.lpVtbl = &MimeFilterProtocolVtbl; ret->IInternetProtocol_iface.lpVtbl = &MimeFilterProtocolVtbl;
ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl;
...@@ -467,7 +467,7 @@ static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret) ...@@ -467,7 +467,7 @@ static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret)
if(*end_ptr) { if(*end_ptr) {
unsigned len = end_ptr-ptr; unsigned len = end_ptr-ptr;
ext = heap_alloc((len+1)*sizeof(WCHAR)); ext = malloc((len + 1) * sizeof(WCHAR));
if(!ext) if(!ext)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -476,7 +476,7 @@ static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret) ...@@ -476,7 +476,7 @@ static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret)
} }
hres = find_mime_from_ext(ext ? ext : ptr, ret); hres = find_mime_from_ext(ext ? ext : ptr, ret);
heap_free(ext); free(ext);
return hres; return hres;
} }
......
...@@ -89,7 +89,7 @@ static ULONG WINAPI MkProtocolUnk_Release(IUnknown *iface) ...@@ -89,7 +89,7 @@ static ULONG WINAPI MkProtocolUnk_Release(IUnknown *iface)
if(This->stream) if(This->stream)
IStream_Release(This->stream); IStream_Release(This->stream);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -293,7 +293,7 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, ...@@ -293,7 +293,7 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
} }
len = lstrlenW(path); len = lstrlenW(path);
display_name = heap_alloc((len+1)*sizeof(WCHAR)); display_name = malloc((len + 1) * sizeof(WCHAR));
memcpy(display_name, path, (len+1)*sizeof(WCHAR)); memcpy(display_name, path, (len+1)*sizeof(WCHAR));
progid[colon_ptr-progid] = 0; /* overwrite ':' with NULL terminator */ progid[colon_ptr-progid] = 0; /* overwrite ':' with NULL terminator */
...@@ -301,7 +301,7 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, ...@@ -301,7 +301,7 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
SysFreeString(path); SysFreeString(path);
if(FAILED(hres)) if(FAILED(hres))
{ {
heap_free(display_name); free(display_name);
return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER); return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
} }
...@@ -309,12 +309,12 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, ...@@ -309,12 +309,12 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
&IID_IParseDisplayName, (void**)&pdn); &IID_IParseDisplayName, (void**)&pdn);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("Could not create object %s\n", debugstr_guid(&clsid)); WARN("Could not create object %s\n", debugstr_guid(&clsid));
heap_free(display_name); free(display_name);
return report_result(pOIProtSink, hres, ERROR_INVALID_PARAMETER); return report_result(pOIProtSink, hres, ERROR_INVALID_PARAMETER);
} }
hres = IParseDisplayName_ParseDisplayName(pdn, NULL /* FIXME */, display_name, &eaten, &mon); hres = IParseDisplayName_ParseDisplayName(pdn, NULL /* FIXME */, display_name, &eaten, &mon);
heap_free(display_name); free(display_name);
IParseDisplayName_Release(pdn); IParseDisplayName_Release(pdn);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("ParseDisplayName failed: %08lx\n", hres); WARN("ParseDisplayName failed: %08lx\n", hres);
...@@ -370,7 +370,7 @@ HRESULT MkProtocol_Construct(IUnknown *outer, void **ppv) ...@@ -370,7 +370,7 @@ HRESULT MkProtocol_Construct(IUnknown *outer, void **ppv)
URLMON_LockModule(); URLMON_LockModule();
ret = heap_alloc(sizeof(MkProtocol)); ret = malloc(sizeof(MkProtocol));
ret->IUnknown_inner.lpVtbl = &MkProtocolUnkVtbl; ret->IUnknown_inner.lpVtbl = &MkProtocolUnkVtbl;
ret->IInternetProtocolEx_iface.lpVtbl = &MkProtocolVtbl; ret->IInternetProtocolEx_iface.lpVtbl = &MkProtocolVtbl;
......
...@@ -171,12 +171,12 @@ static void WINAPI internet_status_callback(HINTERNET internet, DWORD_PTR contex ...@@ -171,12 +171,12 @@ static void WINAPI internet_status_callback(HINTERNET internet, DWORD_PTR contex
TRACE("%p INTERNET_STATUS_CONNECTING_TO_SERVER %s\n", protocol, (const char*)status_info); TRACE("%p INTERNET_STATUS_CONNECTING_TO_SERVER %s\n", protocol, (const char*)status_info);
info = heap_strdupAtoW(status_info); info = strdupAtoW(status_info);
if(!info) if(!info)
return; return;
report_progress(protocol, BINDSTATUS_CONNECTING, info); report_progress(protocol, BINDSTATUS_CONNECTING, info);
heap_free(info); free(info);
break; break;
} }
...@@ -274,7 +274,7 @@ static HINTERNET create_internet_session(IInternetBindInfo *bind_info) ...@@ -274,7 +274,7 @@ static HINTERNET create_internet_session(IInternetBindInfo *bind_info)
global_user_agent = get_useragent(); global_user_agent = get_useragent();
ret = InternetOpenW(user_agent ? user_agent : global_user_agent, 0, NULL, NULL, INTERNET_FLAG_ASYNC); ret = InternetOpenW(user_agent ? user_agent : global_user_agent, 0, NULL, NULL, INTERNET_FLAG_ASYNC);
heap_free(global_user_agent); free(global_user_agent);
CoTaskMemFree(user_agent); CoTaskMemFree(user_agent);
if(!ret) { if(!ret) {
WARN("InternetOpen failed: %ld\n", GetLastError()); WARN("InternetOpen failed: %ld\n", GetLastError());
......
...@@ -304,15 +304,15 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain ...@@ -304,15 +304,15 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain
WCHAR *component; WCHAR *component;
DWORD i; DWORD i;
subdomain = heap_alloc((subdomain_len+1)*sizeof(WCHAR)); subdomain = malloc((subdomain_len + 1) * sizeof(WCHAR));
if(!subdomain) { if(!subdomain) {
RegCloseKey(domain_key); RegCloseKey(domain_key);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
component = heap_strndupW(host, matched-host-1); component = strndupW(host, matched-host - 1);
if(!component) { if(!component) {
heap_free(subdomain); free(subdomain);
RegCloseKey(domain_key); RegCloseKey(domain_key);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -323,8 +323,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain ...@@ -323,8 +323,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain
res = RegEnumKeyExW(domain_key, i, subdomain, &len, NULL, NULL, NULL, NULL); res = RegEnumKeyExW(domain_key, i, subdomain, &len, NULL, NULL, NULL, NULL);
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
heap_free(component); free(component);
heap_free(subdomain); free(subdomain);
RegCloseKey(domain_key); RegCloseKey(domain_key);
return E_UNEXPECTED; return E_UNEXPECTED;
} }
...@@ -336,8 +336,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain ...@@ -336,8 +336,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
ERR("Unable to open subdomain key %s of %s: %ld\n", debugstr_w(subdomain), ERR("Unable to open subdomain key %s of %s: %ld\n", debugstr_w(subdomain),
debugstr_w(domain), res); debugstr_w(domain), res);
heap_free(component); free(component);
heap_free(subdomain); free(subdomain);
RegCloseKey(domain_key); RegCloseKey(domain_key);
return E_UNEXPECTED; return E_UNEXPECTED;
} }
...@@ -348,8 +348,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain ...@@ -348,8 +348,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain
break; break;
} }
} }
heap_free(subdomain); free(subdomain);
heap_free(component); free(component);
} }
/* There's a chance that 'host' implicitly mapped into 'domain', in /* There's a chance that 'host' implicitly mapped into 'domain', in
...@@ -400,7 +400,7 @@ static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR h ...@@ -400,7 +400,7 @@ static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR h
if(!domain_count) if(!domain_count)
return S_FALSE; return S_FALSE;
domain = heap_alloc((domain_len+1)*sizeof(WCHAR)); domain = malloc((domain_len + 1) * sizeof(WCHAR));
if(!domain) if(!domain)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -409,7 +409,7 @@ static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR h ...@@ -409,7 +409,7 @@ static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR h
res = RegEnumKeyExW(domains, i, domain, &len, NULL, NULL, NULL, NULL); res = RegEnumKeyExW(domains, i, domain, &len, NULL, NULL, NULL, NULL);
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
heap_free(domain); free(domain);
return E_UNEXPECTED; return E_UNEXPECTED;
} }
...@@ -418,7 +418,7 @@ static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR h ...@@ -418,7 +418,7 @@ static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR h
break; break;
} }
heap_free(domain); free(domain);
return hres; return hres;
} }
...@@ -863,7 +863,7 @@ static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManagerEx2* iface) ...@@ -863,7 +863,7 @@ static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManagerEx2* iface)
if(This->custom_manager) if(This->custom_manager)
IInternetSecurityManager_Release(This->custom_manager); IInternetSecurityManager_Release(This->custom_manager);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -1208,7 +1208,7 @@ HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) ...@@ -1208,7 +1208,7 @@ HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
SecManagerImpl *This; SecManagerImpl *This;
TRACE("(%p,%p)\n",pUnkOuter,ppobj); TRACE("(%p,%p)\n",pUnkOuter,ppobj);
This = heap_alloc(sizeof(*This)); This = malloc(sizeof(*This));
/* Initialize the virtual function table. */ /* Initialize the virtual function table. */
This->IInternetSecurityManagerEx2_iface.lpVtbl = &VT_SecManagerImpl; This->IInternetSecurityManagerEx2_iface.lpVtbl = &VT_SecManagerImpl;
...@@ -1262,7 +1262,7 @@ static LPDWORD build_zonemap_from_reg(void) ...@@ -1262,7 +1262,7 @@ static LPDWORD build_zonemap_from_reg(void)
if (res) if (res)
return NULL; return NULL;
data = heap_alloc(allocated * sizeof(DWORD)); data = malloc(allocated * sizeof(DWORD));
if (!data) if (!data)
goto cleanup; goto cleanup;
...@@ -1276,12 +1276,13 @@ static LPDWORD build_zonemap_from_reg(void) ...@@ -1276,12 +1276,13 @@ static LPDWORD build_zonemap_from_reg(void)
if (used == allocated) { if (used == allocated) {
LPDWORD new_data; LPDWORD new_data;
allocated *= 2; new_data = realloc(data, allocated * sizeof(DWORD));
new_data = heap_realloc_zero(data, allocated * sizeof(DWORD));
if (!new_data) if (!new_data)
goto cleanup; goto cleanup;
memset(new_data + allocated, 0, allocated * sizeof(DWORD));
data = new_data; data = new_data;
allocated *= 2;
} }
data[used] = wcstol(name, NULL, 10); data[used] = wcstol(name, NULL, 10);
} }
...@@ -1295,7 +1296,7 @@ static LPDWORD build_zonemap_from_reg(void) ...@@ -1295,7 +1296,7 @@ static LPDWORD build_zonemap_from_reg(void)
cleanup: cleanup:
/* something failed */ /* something failed */
RegCloseKey(hkey); RegCloseKey(hkey);
heap_free(data); free(data);
return NULL; return NULL;
} }
...@@ -1356,9 +1357,9 @@ static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManagerEx2* iface) ...@@ -1356,9 +1357,9 @@ static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManagerEx2* iface)
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1); TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
if(!refCount) { if(!refCount) {
while (This->zonemap_count) heap_free(This->zonemaps[--This->zonemap_count]); while (This->zonemap_count) free(This->zonemaps[--This->zonemap_count]);
heap_free(This->zonemaps); free(This->zonemaps);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -1571,18 +1572,20 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2* ...@@ -1571,18 +1572,20 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2*
if (This->zonemaps) { if (This->zonemaps) {
/* try to double the nr. of pointers in the array */ /* try to double the nr. of pointers in the array */
new_maps = heap_realloc_zero(This->zonemaps, This->zonemap_count * 2 * sizeof(LPDWORD)); new_maps = realloc(This->zonemaps, This->zonemap_count * 2 * sizeof(DWORD*));
if (new_maps) if (new_maps) {
memset(new_maps + This->zonemap_count, 0, This->zonemap_count * sizeof(DWORD*));
This->zonemap_count *= 2; This->zonemap_count *= 2;
}
} }
else else
{ {
This->zonemap_count = 2; This->zonemap_count = 2;
new_maps = heap_alloc_zero(This->zonemap_count * sizeof(LPDWORD)); new_maps = calloc(This->zonemap_count, sizeof(DWORD*));
} }
if (!new_maps) { if (!new_maps) {
heap_free(data); free(data);
return E_FAIL; return E_FAIL;
} }
This->zonemaps = new_maps; This->zonemaps = new_maps;
...@@ -1631,7 +1634,7 @@ static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManagerEx2* ...@@ -1631,7 +1634,7 @@ static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManagerEx2*
if (dwEnum < This->zonemap_count) { if (dwEnum < This->zonemap_count) {
if ((data = This->zonemaps[dwEnum])) { if ((data = This->zonemaps[dwEnum])) {
This->zonemaps[dwEnum] = NULL; This->zonemaps[dwEnum] = NULL;
heap_free(data); free(data);
return S_OK; return S_OK;
} }
} }
...@@ -1787,7 +1790,7 @@ static const IInternetZoneManagerEx2Vtbl ZoneMgrImplVtbl = { ...@@ -1787,7 +1790,7 @@ static const IInternetZoneManagerEx2Vtbl ZoneMgrImplVtbl = {
HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
{ {
ZoneMgrImpl* ret = heap_alloc_zero(sizeof(ZoneMgrImpl)); ZoneMgrImpl *ret = calloc(1, sizeof(ZoneMgrImpl));
TRACE("(%p %p)\n", pUnkOuter, ppobj); TRACE("(%p %p)\n", pUnkOuter, ppobj);
ret->IInternetZoneManagerEx2_iface.lpVtbl = &ZoneMgrImplVtbl; ret->IInternetZoneManagerEx2_iface.lpVtbl = &ZoneMgrImplVtbl;
......
...@@ -76,12 +76,12 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, ...@@ -76,12 +76,12 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid,
static const WCHAR wszProtocolsKey[] = static const WCHAR wszProtocolsKey[] =
{'P','R','O','T','O','C','O','L','S','\\','H','a','n','d','l','e','r','\\'}; {'P','R','O','T','O','C','O','L','S','\\','H','a','n','d','l','e','r','\\'};
wszKey = heap_alloc(sizeof(wszProtocolsKey)+(schema_len+1)*sizeof(WCHAR)); wszKey = malloc(sizeof(wszProtocolsKey) + (schema_len + 1) * sizeof(WCHAR));
memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey)); memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey));
memcpy(wszKey + ARRAY_SIZE(wszProtocolsKey), schema, (schema_len+1)*sizeof(WCHAR)); memcpy(wszKey + ARRAY_SIZE(wszProtocolsKey), schema, (schema_len+1)*sizeof(WCHAR));
res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey); res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey);
heap_free(wszKey); free(wszKey);
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
TRACE("Could not open protocol handler key\n"); TRACE("Could not open protocol handler key\n");
return MK_E_SYNTAX; return MK_E_SYNTAX;
...@@ -115,14 +115,14 @@ HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BO ...@@ -115,14 +115,14 @@ HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BO
{ {
name_space *new_name_space; name_space *new_name_space;
new_name_space = heap_alloc(sizeof(name_space)); new_name_space = malloc(sizeof(name_space));
if(!urlmon_protocol) if(!urlmon_protocol)
IClassFactory_AddRef(cf); IClassFactory_AddRef(cf);
new_name_space->cf = cf; new_name_space->cf = cf;
new_name_space->clsid = *clsid; new_name_space->clsid = *clsid;
new_name_space->urlmon = urlmon_protocol; new_name_space->urlmon = urlmon_protocol;
new_name_space->protocol = heap_strdupW(protocol); new_name_space->protocol = wcsdup(protocol);
EnterCriticalSection(&session_cs); EnterCriticalSection(&session_cs);
...@@ -147,8 +147,8 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol) ...@@ -147,8 +147,8 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
if(!iter->urlmon) if(!iter->urlmon)
IClassFactory_Release(iter->cf); IClassFactory_Release(iter->cf);
heap_free(iter->protocol); free(iter->protocol);
heap_free(iter); free(iter);
return S_OK; return S_OK;
} }
} }
...@@ -370,12 +370,12 @@ static HRESULT WINAPI InternetSession_RegisterMimeFilter(IInternetSession *iface ...@@ -370,12 +370,12 @@ static HRESULT WINAPI InternetSession_RegisterMimeFilter(IInternetSession *iface
TRACE("(%p %s %s)\n", pCF, debugstr_guid(rclsid), debugstr_w(pwzType)); TRACE("(%p %s %s)\n", pCF, debugstr_guid(rclsid), debugstr_w(pwzType));
filter = heap_alloc(sizeof(mime_filter)); filter = malloc(sizeof(mime_filter));
IClassFactory_AddRef(pCF); IClassFactory_AddRef(pCF);
filter->cf = pCF; filter->cf = pCF;
filter->clsid = *rclsid; filter->clsid = *rclsid;
filter->mime = heap_strdupW(pwzType); filter->mime = wcsdup(pwzType);
EnterCriticalSection(&session_cs); EnterCriticalSection(&session_cs);
...@@ -402,8 +402,8 @@ static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *ifa ...@@ -402,8 +402,8 @@ static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *ifa
LeaveCriticalSection(&session_cs); LeaveCriticalSection(&session_cs);
IClassFactory_Release(iter->cf); IClassFactory_Release(iter->cf);
heap_free(iter->mime); free(iter->mime);
heap_free(iter); free(iter);
return S_OK; return S_OK;
} }
} }
...@@ -609,7 +609,7 @@ static void ensure_user_agent(void) ...@@ -609,7 +609,7 @@ static void ensure_user_agent(void)
if(!user_agent) { if(!user_agent) {
WCHAR buf[1024]; WCHAR buf[1024];
obtain_user_agent(0, buf, ARRAY_SIZE(buf)); obtain_user_agent(0, buf, ARRAY_SIZE(buf));
user_agent = heap_strdupW(buf); user_agent = wcsdup(buf);
} }
LeaveCriticalSection(&session_cs); LeaveCriticalSection(&session_cs);
...@@ -622,7 +622,7 @@ LPWSTR get_useragent(void) ...@@ -622,7 +622,7 @@ LPWSTR get_useragent(void)
ensure_user_agent(); ensure_user_agent();
EnterCriticalSection(&session_cs); EnterCriticalSection(&session_cs);
ret = heap_strdupW(user_agent); ret = wcsdup(user_agent);
LeaveCriticalSection(&session_cs); LeaveCriticalSection(&session_cs);
return ret; return ret;
...@@ -705,7 +705,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf ...@@ -705,7 +705,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf
TRACE("Setting user agent %s\n", debugstr_an(buf, len)); TRACE("Setting user agent %s\n", debugstr_an(buf, len));
size = MultiByteToWideChar(CP_ACP, 0, buf, len, NULL, 0); size = MultiByteToWideChar(CP_ACP, 0, buf, len, NULL, 0);
new_user_agent = heap_alloc((size+1)*sizeof(WCHAR)); new_user_agent = malloc((size + 1) * sizeof(WCHAR));
if(!new_user_agent) if(!new_user_agent)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, buf, len, new_user_agent, size); MultiByteToWideChar(CP_ACP, 0, buf, len, new_user_agent, size);
...@@ -713,7 +713,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf ...@@ -713,7 +713,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf
EnterCriticalSection(&session_cs); EnterCriticalSection(&session_cs);
heap_free(user_agent); free(user_agent);
user_agent = new_user_agent; user_agent = new_user_agent;
user_agent_set = TRUE; user_agent_set = TRUE;
update_user_agent(user_agent); update_user_agent(user_agent);
...@@ -800,15 +800,15 @@ void free_session(void) ...@@ -800,15 +800,15 @@ void free_session(void)
LIST_FOR_EACH_ENTRY_SAFE(ns_iter, ns_last, &name_space_list, name_space, entry) { LIST_FOR_EACH_ENTRY_SAFE(ns_iter, ns_last, &name_space_list, name_space, entry) {
if(!ns_iter->urlmon) if(!ns_iter->urlmon)
IClassFactory_Release(ns_iter->cf); IClassFactory_Release(ns_iter->cf);
heap_free(ns_iter->protocol); free(ns_iter->protocol);
heap_free(ns_iter); free(ns_iter);
} }
LIST_FOR_EACH_ENTRY_SAFE(mf_iter, mf_last, &mime_filter_list, mime_filter, entry) { LIST_FOR_EACH_ENTRY_SAFE(mf_iter, mf_last, &mime_filter_list, mime_filter, entry) {
IClassFactory_Release(mf_iter->cf); IClassFactory_Release(mf_iter->cf);
heap_free(mf_iter->mime); free(mf_iter->mime);
heap_free(mf_iter); free(mf_iter);
} }
heap_free(user_agent); free(user_agent);
} }
...@@ -102,7 +102,7 @@ static ULONG WINAPI URLMoniker_Release(IMoniker *iface) ...@@ -102,7 +102,7 @@ static ULONG WINAPI URLMoniker_Release(IMoniker *iface)
if(This->uri) if(This->uri)
IUri_Release(This->uri); IUri_Release(This->uri);
SysFreeString(This->URLName); SysFreeString(This->URLName);
heap_free(This); free(This);
URLMON_UnlockModule(); URLMON_UnlockModule();
} }
...@@ -162,7 +162,7 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm) ...@@ -162,7 +162,7 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
if(got != sizeof(ULONG)) if(got != sizeof(ULONG))
return E_FAIL; return E_FAIL;
new_uri_str = heap_alloc(size+sizeof(WCHAR)); new_uri_str = malloc(size + sizeof(WCHAR));
if(!new_uri_str) if(!new_uri_str)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -170,7 +170,7 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm) ...@@ -170,7 +170,7 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
new_uri_str[size/sizeof(WCHAR)] = 0; new_uri_str[size/sizeof(WCHAR)] = 0;
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
hres = CreateUri(new_uri_str, 0, 0, &new_uri); hres = CreateUri(new_uri_str, 0, 0, &new_uri);
heap_free(new_uri_str); free(new_uri_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -557,7 +557,7 @@ static HRESULT create_moniker(IUri *uri, URLMoniker **ret) ...@@ -557,7 +557,7 @@ static HRESULT create_moniker(IUri *uri, URLMoniker **ret)
URLMoniker *mon; URLMoniker *mon;
HRESULT hres; HRESULT hres;
mon = heap_alloc(sizeof(*mon)); mon = malloc(sizeof(*mon));
if(!mon) if(!mon)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -569,7 +569,7 @@ static HRESULT create_moniker(IUri *uri, URLMoniker **ret) ...@@ -569,7 +569,7 @@ static HRESULT create_moniker(IUri *uri, URLMoniker **ret)
/* FIXME: try to avoid it */ /* FIXME: try to avoid it */
hres = IUri_GetDisplayUri(uri, &mon->URLName); hres = IUri_GetDisplayUri(uri, &mon->URLName);
if(FAILED(hres)) { if(FAILED(hres)) {
heap_free(mon); free(mon);
return hres; return hres;
} }
...@@ -843,12 +843,12 @@ HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPST ...@@ -843,12 +843,12 @@ HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPST
if(szURL) { if(szURL) {
len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
url = heap_alloc(len*sizeof(WCHAR)); url = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szURL, -1, url, len); MultiByteToWideChar(CP_ACP, 0, szURL, -1, url, len);
} }
if(szFileName) if(szFileName)
file_name = heap_alloc(dwBufLength*sizeof(WCHAR)); file_name = malloc(dwBufLength * sizeof(WCHAR));
hres = URLDownloadToCacheFileW(lpUnkCaller, url, file_name, dwBufLength*sizeof(WCHAR), hres = URLDownloadToCacheFileW(lpUnkCaller, url, file_name, dwBufLength*sizeof(WCHAR),
dwReserved, pBSC); dwReserved, pBSC);
...@@ -856,8 +856,8 @@ HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPST ...@@ -856,8 +856,8 @@ HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPST
if(SUCCEEDED(hres) && file_name) if(SUCCEEDED(hres) && file_name)
WideCharToMultiByte(CP_ACP, 0, file_name, -1, szFileName, dwBufLength, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, file_name, -1, szFileName, dwBufLength, NULL, NULL);
heap_free(url); free(url);
heap_free(file_name); free(file_name);
return hres; return hres;
} }
......
...@@ -269,7 +269,7 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL, ...@@ -269,7 +269,7 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL,
return E_INVALIDARG; return E_INVALIDARG;
len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
szURLW = heap_alloc(len * sizeof(WCHAR)); szURLW = malloc(len * sizeof(WCHAR));
if (!szURLW) if (!szURLW)
{ {
*ppStream = NULL; *ppStream = NULL;
...@@ -279,7 +279,7 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL, ...@@ -279,7 +279,7 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL,
hr = URLOpenBlockingStreamW(pCaller, szURLW, ppStream, dwReserved, lpfnCB); hr = URLOpenBlockingStreamW(pCaller, szURLW, ppStream, dwReserved, lpfnCB);
heap_free(szURLW); free(szURLW);
return hr; return hr;
} }
...@@ -321,14 +321,14 @@ HRESULT WINAPI URLOpenStreamA(LPUNKNOWN pCaller, LPCSTR szURL, DWORD dwReserved, ...@@ -321,14 +321,14 @@ HRESULT WINAPI URLOpenStreamA(LPUNKNOWN pCaller, LPCSTR szURL, DWORD dwReserved,
return E_INVALIDARG; return E_INVALIDARG;
len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
szURLW = heap_alloc(len * sizeof(WCHAR)); szURLW = malloc(len * sizeof(WCHAR));
if (!szURLW) if (!szURLW)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, szURL, -1, szURLW, len); MultiByteToWideChar(CP_ACP, 0, szURL, -1, szURLW, len);
hr = URLOpenStreamW(pCaller, szURLW, dwReserved, lpfnCB); hr = URLOpenStreamW(pCaller, szURLW, dwReserved, lpfnCB);
heap_free(szURLW); free(szURLW);
return hr; return hr;
} }
......
...@@ -75,7 +75,7 @@ tls_data_t *get_tls_data(void) ...@@ -75,7 +75,7 @@ tls_data_t *get_tls_data(void)
data = TlsGetValue(urlmon_tls); data = TlsGetValue(urlmon_tls);
if(!data) { if(!data) {
data = heap_alloc_zero(sizeof(tls_data_t)); data = calloc(1, sizeof(tls_data_t));
if(!data) if(!data)
return NULL; return NULL;
...@@ -99,7 +99,7 @@ static void free_tls_list(void) ...@@ -99,7 +99,7 @@ static void free_tls_list(void)
while(!list_empty(&tls_list)) { while(!list_empty(&tls_list)) {
data = LIST_ENTRY(list_head(&tls_list), tls_data_t, entry); data = LIST_ENTRY(list_head(&tls_list), tls_data_t, entry);
list_remove(&data->entry); list_remove(&data->entry);
heap_free(data); free(data);
} }
TlsFree(urlmon_tls); TlsFree(urlmon_tls);
...@@ -125,7 +125,7 @@ static void detach_thread(void) ...@@ -125,7 +125,7 @@ static void detach_thread(void)
DestroyWindow(data->notif_hwnd); DestroyWindow(data->notif_hwnd);
} }
heap_free(data); free(data);
} }
static void process_detach(void) static void process_detach(void)
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "urlmon.h" #include "urlmon.h"
#include "wininet.h" #include "wininet.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
extern HINSTANCE hProxyDll DECLSPEC_HIDDEN; extern HINSTANCE hProxyDll DECLSPEC_HIDDEN;
...@@ -231,33 +230,12 @@ void release_notif_hwnd(HWND) DECLSPEC_HIDDEN; ...@@ -231,33 +230,12 @@ void release_notif_hwnd(HWND) DECLSPEC_HIDDEN;
const char *debugstr_bindstatus(ULONG) DECLSPEC_HIDDEN; const char *debugstr_bindstatus(ULONG) DECLSPEC_HIDDEN;
static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t size) static inline WCHAR *strndupW(LPCWSTR str, int len)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size);
}
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 heap_strndupW(LPCWSTR str, int len)
{ {
LPWSTR ret = NULL; LPWSTR ret = NULL;
if(str) { if(str) {
ret = heap_alloc((len+1)*sizeof(WCHAR)); ret = malloc((len + 1) * sizeof(WCHAR));
if(ret) { if(ret) {
memcpy(ret, str, len*sizeof(WCHAR)); memcpy(ret, str, len*sizeof(WCHAR));
ret[len] = 0; ret[len] = 0;
...@@ -267,13 +245,13 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, int len) ...@@ -267,13 +245,13 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, int len)
return ret; return ret;
} }
static inline LPWSTR heap_strdupAtoW(const char *str) static inline WCHAR *strdupAtoW(const char *str)
{ {
LPWSTR ret = NULL; LPWSTR ret = NULL;
if(str) { if(str) {
DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = heap_alloc(len*sizeof(WCHAR)); ret = malloc(len * sizeof(WCHAR));
if(ret) if(ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
} }
......
...@@ -131,7 +131,7 @@ static HRESULT marshal_stgmed(STGMEDIUM *stgmed, RemSTGMEDIUM **ret) ...@@ -131,7 +131,7 @@ static HRESULT marshal_stgmed(STGMEDIUM *stgmed, RemSTGMEDIUM **ret)
IStream_Seek(stream, zero, STREAM_SEEK_SET, &off); IStream_Seek(stream, zero, STREAM_SEEK_SET, &off);
} }
rem_stgmed = heap_alloc_zero(FIELD_OFFSET(RemSTGMEDIUM, data[size])); rem_stgmed = calloc(1, FIELD_OFFSET(RemSTGMEDIUM, data[size]));
if(!rem_stgmed) { if(!rem_stgmed) {
if(stream) if(stream)
IStream_Release(stream); IStream_Release(stream);
...@@ -333,7 +333,7 @@ HRESULT CALLBACK IBindStatusCallback_OnDataAvailable_Proxy( ...@@ -333,7 +333,7 @@ HRESULT CALLBACK IBindStatusCallback_OnDataAvailable_Proxy(
hres = IBindStatusCallback_RemoteOnDataAvailable_Proxy(This, grfBSCF, dwSize, &rem_formatetc, rem_stgmed); hres = IBindStatusCallback_RemoteOnDataAvailable_Proxy(This, grfBSCF, dwSize, &rem_formatetc, rem_stgmed);
heap_free(rem_stgmed); free(rem_stgmed);
return hres; return hres;
} }
......
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