From: Alex Henrie alexhenrie24@gmail.com
--- dlls/urlmon/axinstall.c | 14 ++--- dlls/urlmon/bindctx.c | 8 +-- dlls/urlmon/binding.c | 46 ++++++++-------- dlls/urlmon/bindprot.c | 50 +++++++++--------- dlls/urlmon/download.c | 22 ++++---- dlls/urlmon/file.c | 4 +- dlls/urlmon/format.c | 8 +-- dlls/urlmon/ftp.c | 4 +- dlls/urlmon/gopher.c | 4 +- dlls/urlmon/http.c | 22 ++++---- dlls/urlmon/mimefilter.c | 8 +-- dlls/urlmon/mk.c | 12 ++--- dlls/urlmon/protocol.c | 6 +-- dlls/urlmon/sec_mgr.c | 57 ++++++++++---------- dlls/urlmon/session.c | 38 +++++++------- dlls/urlmon/umon.c | 18 +++---- dlls/urlmon/umstream.c | 8 +-- dlls/urlmon/uri.c | 108 +++++++++++++++++++------------------- dlls/urlmon/urlmon_main.c | 6 +-- dlls/urlmon/urlmon_main.h | 30 ++--------- dlls/urlmon/usrmarshal.c | 4 +- 21 files changed, 229 insertions(+), 248 deletions(-)
diff --git a/dlls/urlmon/axinstall.c b/dlls/urlmon/axinstall.c index 9d5e99ccc7d..ca87f5c5436 100644 --- a/dlls/urlmon/axinstall.c +++ b/dlls/urlmon/axinstall.c @@ -57,8 +57,8 @@ static void release_install_ctx(install_ctx_t *ctx) IUri_Release(ctx->uri); if(ctx->callback) IBindStatusCallback_Release(ctx->callback); - heap_free(ctx->install_file); - heap_free(ctx); + free(ctx->install_file); + free(ctx); }
static inline BOOL file_exists(const WCHAR *file_name) @@ -80,7 +80,7 @@ static HRESULT extract_cab_file(install_ctx_t *ctx)
path_len = lstrlenW(ctx->tmp_dir); 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) return E_OUTOFMEMORY;
@@ -192,13 +192,13 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
expand_command(ctx, val, NULL, &size);
- cmd = heap_alloc(size*sizeof(WCHAR)); + cmd = malloc(size * sizeof(WCHAR)); if(!cmd) return E_OUTOFMEMORY;
expand_command(ctx, val, cmd, &size); hres = RunSetupCommandW(ctx->hwnd, cmd, NULL, ctx->tmp_dir, NULL, NULL, 0, NULL); - heap_free(cmd); + free(cmd); if(FAILED(hres)) return hres; }else { @@ -505,13 +505,13 @@ HRESULT WINAPI AsyncInstallDistributionUnit(const WCHAR *szDistUnit, const WCHAR if(szDistUnit || szTYPE || szExt) FIXME("Unsupported arguments\n");
- ctx = heap_alloc_zero(sizeof(*ctx)); + ctx = calloc(1, sizeof(*ctx)); if(!ctx) return E_OUTOFMEMORY;
hres = CreateUri(szURL, 0, 0, &ctx->uri); if(FAILED(hres)) { - heap_free(ctx); + free(ctx); return E_OUTOFMEMORY; }
diff --git a/dlls/urlmon/bindctx.c b/dlls/urlmon/bindctx.c index bac3ca0a3ee..b34c7bb7b0c 100644 --- a/dlls/urlmon/bindctx.c +++ b/dlls/urlmon/bindctx.c @@ -162,7 +162,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallbackEx *iface) if(This->serv_prov) IServiceProvider_Release(This->serv_prov); IBindStatusCallback_Release(This->callback); - heap_free(This); + free(This); }
return ref; @@ -579,7 +579,7 @@ HRESULT wrap_callback(IBindStatusCallback *bsc, IBindStatusCallback **ret_iface) { BindStatusCallback *ret;
- ret = heap_alloc_zero(sizeof(BindStatusCallback)); + ret = calloc(1, sizeof(BindStatusCallback)); if(!ret) return E_OUTOFMEMORY;
@@ -751,7 +751,7 @@ static ULONG WINAPI AsyncBindCtx_Release(IBindCtx *iface)
if(!ref) { IBindCtx_Release(This->bindctx); - heap_free(This); + free(This); }
return ref; @@ -951,7 +951,7 @@ HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options, return hres; }
- ret = heap_alloc(sizeof(AsyncBindCtx)); + ret = malloc(sizeof(AsyncBindCtx));
ret->IBindCtx_iface.lpVtbl = &AsyncBindCtxVtbl; ret->ref = 1; diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c index 59f7430eafd..fd738f6cf0f 100644 --- a/dlls/urlmon/binding.c +++ b/dlls/urlmon/binding.c @@ -160,8 +160,8 @@ static void dump_BINDINFO(BINDINFO *bi)
static void mime_available(Binding *This, LPCWSTR mime) { - heap_free(This->mime); - This->mime = heap_strdupW(mime); + free(This->mime); + This->mime = wcsdup(mime);
if(!This->mime || !This->report_mime) return; @@ -199,31 +199,31 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid) 'C','o','n','t','e','n','t',' ','T','y','p','e','\'};
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)); lstrcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey); - heap_free(key_name); + free(key_name); if(res != ERROR_SUCCESS) { WARN("Could not open MIME key: %lx\n", res); return NULL; }
size = 50*sizeof(WCHAR); - ret = heap_alloc(size); + ret = malloc(size); res = RegQueryValueExW(hkey, L"CLSID", NULL, &type, (BYTE*)ret, &size); RegCloseKey(hkey); if(res != ERROR_SUCCESS) { WARN("Could not get CLSID: %08lx\n", res); - heap_free(ret); + free(ret); return NULL; }
hres = CLSIDFromString(ret, clsid); if(FAILED(hres)) { WARN("Could not parse CLSID: %08lx\n", hres); - heap_free(ret); + free(ret); return NULL; }
@@ -307,7 +307,7 @@ static void create_object(Binding *binding)
if(clsid_str) { hres = create_mime_object(binding, &clsid, clsid_str); - heap_free(clsid_str); + free(clsid_str); }else { FIXME("Could not find object for MIME %s\n", debugstr_w(binding->mime)); hres = REGDB_E_CLASSNOTREG; @@ -323,8 +323,8 @@ static void create_object(Binding *binding)
static void cache_file_available(Binding *This, const WCHAR *file_name) { - heap_free(This->stgmed_buf->cache_file); - This->stgmed_buf->cache_file = heap_strdupW(file_name); + free(This->stgmed_buf->cache_file); + This->stgmed_buf->cache_file = wcsdup(file_name);
if(This->use_cache_file) { 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) if(This->file != INVALID_HANDLE_VALUE) CloseHandle(This->file); IInternetProtocolEx_Release(This->protocol); - heap_free(This->cache_file); - heap_free(This); + free(This->cache_file); + free(This);
URLMON_UnlockModule(); } @@ -395,7 +395,7 @@ static const IUnknownVtbl StgMedUnkVtbl = {
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->ref = 1; @@ -471,7 +471,7 @@ static ULONG WINAPI ProtocolStream_Release(IStream *iface)
if(!ref) { IUnknown_Release(&This->buf->IUnknown_iface); - heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -701,7 +701,7 @@ typedef struct {
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->IStream_iface.lpVtbl = &ProtocolStreamVtbl; @@ -720,7 +720,7 @@ static void stgmed_file_release(stgmed_obj_t *obj) stgmed_file_obj_t *file_obj = (stgmed_file_obj_t*)obj;
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) @@ -754,7 +754,7 @@ static const stgmed_obj_vtbl stgmed_file_vtbl = {
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;
@@ -868,9 +868,9 @@ static ULONG WINAPI Binding_Release(IBinding *iface) This->section.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->section); SysFreeString(This->url); - heap_free(This->mime); - heap_free(This->redirect_url); - heap_free(This); + free(This->mime); + free(This->redirect_url); + free(This);
URLMON_UnlockModule(); } @@ -1036,8 +1036,8 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink on_progress(This, 0, 0, BINDSTATUS_CONNECTING, szStatusText); break; case BINDSTATUS_REDIRECTING: - heap_free(This->redirect_url); - This->redirect_url = heap_strdupW(szStatusText); + free(This->redirect_url); + This->redirect_url = wcsdup(szStatusText); on_progress(This, 0, 0, BINDSTATUS_REDIRECTING, szStatusText); break; case BINDSTATUS_BEGINDOWNLOADDATA: @@ -1448,7 +1448,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB
URLMON_LockModule();
- ret = heap_alloc_zero(sizeof(Binding)); + ret = calloc(1, sizeof(Binding));
ret->IBinding_iface.lpVtbl = &BindingVtbl; ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c index 34eb5a499da..b09acdd5c3a 100644 --- a/dlls/urlmon/bindprot.c +++ b/dlls/urlmon/bindprot.c @@ -224,8 +224,8 @@ static void mime_available(BindProtocol *This, LPCWSTR mime, BOOL verified) IInternetProtocol *mime_filter; HRESULT hres;
- heap_free(This->mime); - This->mime = heap_strdupW(mime); + free(This->mime); + This->mime = wcsdup(mime);
if(This->protocol_handler==&This->default_protocol_handler.IInternetProtocol_iface && (mime_filter = get_mime_filter(mime))) { @@ -348,8 +348,8 @@ static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) This->section.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->section);
- heap_free(This->mime); - heap_free(This); + free(This->mime); + free(This);
URLMON_UnlockModule(); } @@ -670,7 +670,7 @@ static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCO
hres = IInternetProtocol_Continue(protocol ? protocol : This->protocol, pProtocolData);
- heap_free(pProtocolData); + free(pProtocolData); if(protocol) IInternetProtocol_Release(protocol); return hres; @@ -754,7 +754,7 @@ static HRESULT WINAPI ProtocolHandler_Read(IInternetProtocol *iface, void *pv, memcpy(pv, This->buf, read);
if(read == This->buf_size) { - heap_free(This->buf); + free(This->buf); This->buf = NULL; }else { memmove(This->buf, This->buf+cb, This->buf_size-cb); @@ -933,13 +933,13 @@ static HRESULT report_data(BindProtocol *This) return hres;
if(!This->buf) { - This->buf = heap_alloc(BUFFER_SIZE); + This->buf = malloc(BUFFER_SIZE); if(!This->buf) return E_OUTOFMEMORY; }else if(read + This->buf_size > BUFFER_SIZE) { BYTE *tmp;
- tmp = heap_realloc(This->buf, read+This->buf_size); + tmp = realloc(This->buf, read + This->buf_size); if(!tmp) return E_OUTOFMEMORY; This->buf = tmp; @@ -969,8 +969,8 @@ static HRESULT report_data(BindProtocol *This) if(FAILED(hres)) return hres;
- heap_free(This->mime); - This->mime = heap_strdupW(mime); + free(This->mime); + This->mime = wcsdup(mime); CoTaskMemFree(mime); This->reported_mime = TRUE; if(This->protocol_sink) @@ -1222,7 +1222,7 @@ static void switch_proc(BindProtocol *bind, task_header_t *t)
IInternetProtocol_Continue(bind->protocol_handler, task->data);
- heap_free(task); + free(task); }
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, pProtocolData->pData, pProtocolData->cbData);
- data = heap_alloc(sizeof(PROTOCOLDATA)); + data = malloc(sizeof(PROTOCOLDATA)); if(!data) return E_OUTOFMEMORY; memcpy(data, pProtocolData, sizeof(PROTOCOLDATA)); @@ -1245,10 +1245,10 @@ static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface || !do_direct_notif(This)) { switch_task_t *task;
- task = heap_alloc(sizeof(switch_task_t)); + task = malloc(sizeof(switch_task_t)); if(!task) { - heap_free(data); + free(data); return E_OUTOFMEMORY; }
@@ -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);
- heap_free(task->status_text); - heap_free(task); + free(task->status_text); + free(task); }
static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, @@ -1290,10 +1290,10 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSin }else { 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_text = heap_strdupW(szStatusText); + task->status_text = wcsdup(szStatusText);
push_task(This, &task->header, on_progress_proc); } @@ -1315,7 +1315,7 @@ static void report_data_proc(BindProtocol *This, task_header_t *t) IInternetProtocolSink_ReportData(This->protocol_sink_handler, task->bscf, task->progress, task->progress_max);
- heap_free(task); + free(task); }
static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *iface, @@ -1331,7 +1331,7 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *i if(!do_direct_notif(This)) { report_data_task_t *task;
- task = heap_alloc(sizeof(report_data_task_t)); + task = malloc(sizeof(report_data_task_t)); if(!task) return E_OUTOFMEMORY;
@@ -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);
- heap_free(task->str); - heap_free(task); + free(task->str); + free(task); }
static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink *iface, @@ -1379,13 +1379,13 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink if(!do_direct_notif(This)) { report_result_task_t *task;
- task = heap_alloc(sizeof(report_result_task_t)); + task = malloc(sizeof(report_result_task_t)); if(!task) return E_OUTOFMEMORY;
task->hres = hrResult; task->err = dwError; - task->str = heap_strdupW(szResult); + task->str = wcsdup(szResult);
push_task(This, &task->header, report_result_proc); return S_OK; @@ -1450,7 +1450,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
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->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl; diff --git a/dlls/urlmon/download.c b/dlls/urlmon/download.c index 98c2f81b32f..c905c486976 100644 --- a/dlls/urlmon/download.c +++ b/dlls/urlmon/download.c @@ -96,9 +96,9 @@ static ULONG WINAPI DownloadBSC_Release(IBindStatusCallback *iface) IBindStatusCallback_Release(This->callback); if(This->binding) IBinding_Release(This->binding); - heap_free(This->file_name); - heap_free(This->cache_file); - heap_free(This); + free(This->file_name); + free(This->cache_file); + free(This); }
return ref; @@ -176,7 +176,7 @@ static HRESULT WINAPI DownloadBSC_OnProgress(IBindStatusCallback *iface, ULONG u
case BINDSTATUS_CACHEFILENAMEAVAILABLE: hres = on_progress(This, ulProgress, ulProgressMax, ulStatusCode, szStatusText); - This->cache_file = heap_strdupW(szStatusText); + This->cache_file = wcsdup(szStatusText); break;
case BINDSTATUS_FINDINGRESOURCE: /* FIXME */ @@ -334,7 +334,7 @@ static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_na { DownloadBSC *ret;
- ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY;
@@ -343,9 +343,9 @@ static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_na ret->ref = 1;
if(file_name) { - ret->file_name = heap_strdupW(file_name); + ret->file_name = wcsdup(file_name); if(!ret->file_name) { - heap_free(ret); + free(ret); return E_OUTOFMEMORY; } } @@ -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);
- urlW = heap_strdupAtoW(szURL); - file_nameW = heap_strdupAtoW(szFileName); + urlW = strdupAtoW(szURL); + file_nameW = strdupAtoW(szFileName);
hres = URLDownloadToFileW(pCaller, urlW, file_nameW, dwReserved, lpfnCB);
- heap_free(urlW); - heap_free(file_nameW); + free(urlW); + free(file_nameW);
return hres; } diff --git a/dlls/urlmon/file.c b/dlls/urlmon/file.c index a21a69da7a1..da71991129b 100644 --- a/dlls/urlmon/file.c +++ b/dlls/urlmon/file.c @@ -102,7 +102,7 @@ static ULONG WINAPI FileProtocolUnk_Release(IUnknown *iface) if(!ref) { if(This->file != INVALID_HANDLE_VALUE) CloseHandle(This->file); - heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -425,7 +425,7 @@ HRESULT FileProtocol_Construct(IUnknown *outer, LPVOID *ppobj)
URLMON_LockModule();
- ret = heap_alloc(sizeof(FileProtocol)); + ret = malloc(sizeof(FileProtocol));
ret->IUnknown_inner.lpVtbl = &FileProtocolUnkVtbl; ret->IInternetProtocolEx_iface.lpVtbl = &FileProtocolExVtbl; diff --git a/dlls/urlmon/format.c b/dlls/urlmon/format.c index da8aae35bf9..8ad313dd677 100644 --- a/dlls/urlmon/format.c +++ b/dlls/urlmon/format.c @@ -74,8 +74,8 @@ static ULONG WINAPI EnumFORMATETC_Release(IEnumFORMATETC *iface) TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { - heap_free(This->fetc); - heap_free(This); + free(This->fetc); + free(This);
URLMON_UnlockModule(); } @@ -156,7 +156,7 @@ static const IEnumFORMATETCVtbl EnumFORMATETCVtbl = {
static IEnumFORMATETC *EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmtetc, UINT it) { - EnumFORMATETC *ret = heap_alloc(sizeof(EnumFORMATETC)); + EnumFORMATETC *ret = malloc(sizeof(EnumFORMATETC));
URLMON_LockModule();
@@ -165,7 +165,7 @@ static IEnumFORMATETC *EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmt ret->it = it; ret->fetc_cnt = cfmtetc;
- ret->fetc = heap_alloc(cfmtetc*sizeof(FORMATETC)); + ret->fetc = malloc(cfmtetc * sizeof(FORMATETC)); memcpy(ret->fetc, rgfmtetc, cfmtetc*sizeof(FORMATETC));
return &ret->IEnumFORMATETC_iface; diff --git a/dlls/urlmon/ftp.c b/dlls/urlmon/ftp.c index 93f41a90a08..6170775366c 100644 --- a/dlls/urlmon/ftp.c +++ b/dlls/urlmon/ftp.c @@ -177,7 +177,7 @@ static ULONG WINAPI FtpProtocolUnk_Release(IUnknown *iface)
if(!ref) { protocol_close_connection(&This->base); - heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -459,7 +459,7 @@ HRESULT FtpProtocol_Construct(IUnknown *outer, void **ppv)
URLMON_LockModule();
- ret = heap_alloc_zero(sizeof(FtpProtocol)); + ret = calloc(1, sizeof(FtpProtocol));
ret->base.vtbl = &AsyncProtocolVtbl; ret->IUnknown_inner.lpVtbl = &FtpProtocolUnkVtbl; diff --git a/dlls/urlmon/gopher.c b/dlls/urlmon/gopher.c index 1f67cb542dd..6af3ef44f9d 100644 --- a/dlls/urlmon/gopher.c +++ b/dlls/urlmon/gopher.c @@ -133,7 +133,7 @@ static ULONG WINAPI GopherProtocol_Release(IInternetProtocol *iface) TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { - heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -317,7 +317,7 @@ HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
URLMON_LockModule();
- ret = heap_alloc_zero(sizeof(GopherProtocol)); + ret = calloc(1, sizeof(GopherProtocol));
ret->base.vtbl = &AsyncProtocolVtbl; ret->IInternetProtocol_iface.lpVtbl = &GopherProtocolVtbl; diff --git a/dlls/urlmon/http.c b/dlls/urlmon/http.c index 2bc9c5be075..d1c104fc8e3 100644 --- a/dlls/urlmon/http.c +++ b/dlls/urlmon/http.c @@ -75,12 +75,12 @@ static LPWSTR query_http_info(HttpProtocol *This, DWORD option)
res = HttpQueryInfoW(This->base.request, option, NULL, &len, NULL); if (!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - ret = heap_alloc(len); + ret = malloc(len); res = HttpQueryInfoW(This->base.request, option, ret, &len, NULL); } if(!res) { TRACE("HttpQueryInfoW(%ld) failed: %08lx\n", option, GetLastError()); - heap_free(ret); + free(ret); return NULL; }
@@ -408,7 +408,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
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) { IServiceProvider_Release(service_provider); return E_OUTOFMEMORY; @@ -529,7 +529,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) location = query_http_info(This, HTTP_QUERY_LOCATION); This->base.flags |= FLAG_RESULT_REPORTED | FLAG_LAST_DATA_REPORTED; IInternetProtocolSink_ReportResult(This->base.protocol_sink, INET_E_REDIRECT_FAILED, 0, location); - heap_free(location); + free(location); return INET_E_REDIRECT_FAILED; }
@@ -537,7 +537,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) if(response_headers) { hres = IHttpNegotiate_OnResponse(This->http_negotiate, status_code, response_headers, NULL, NULL); - heap_free(response_headers); + free(response_headers); if (hres != S_OK) { WARN("IHttpNegotiate_OnResponse failed: %08lx\n", hres); return S_OK; @@ -550,7 +550,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) ranges = query_http_info(This, HTTP_QUERY_ACCEPT_RANGES); if(ranges) { IInternetProtocolSink_ReportProgress(This->base.protocol_sink, BINDSTATUS_ACCEPTRANGES, NULL); - heap_free(ranges); + free(ranges); }
content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE); @@ -563,7 +563,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) (This->base.bindf & BINDF_FROMURLMON) ? BINDSTATUS_MIMETYPEAVAILABLE : BINDSTATUS_RAWMIMETYPE, content_type); - heap_free(content_type); + free(content_type); }else { WARN("HttpQueryInfo failed: %ld\n", GetLastError()); IInternetProtocolSink_ReportProgress(This->base.protocol_sink, @@ -574,7 +574,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH); if(content_length) { This->base.content_length = wcstol(content_length, NULL, 10); - heap_free(content_length); + free(content_length); }
return S_OK; @@ -589,7 +589,7 @@ static void HttpProtocol_close_connection(Protocol *prot) This->http_negotiate = NULL; }
- heap_free(This->full_header); + free(This->full_header); This->full_header = NULL; }
@@ -677,7 +677,7 @@ static ULONG WINAPI HttpProtocolUnk_Release(IUnknown *iface)
if(!ref) { protocol_close_connection(&This->base); - heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -956,7 +956,7 @@ static HRESULT create_http_protocol(BOOL https, IUnknown *outer, void **ppobj) { HttpProtocol *ret;
- ret = heap_alloc_zero(sizeof(HttpProtocol)); + ret = calloc(1, sizeof(HttpProtocol)); if(!ret) return E_OUTOFMEMORY;
diff --git a/dlls/urlmon/mimefilter.c b/dlls/urlmon/mimefilter.c index a709a42a3c5..793de18a853 100644 --- a/dlls/urlmon/mimefilter.c +++ b/dlls/urlmon/mimefilter.c @@ -77,7 +77,7 @@ static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface) TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { - heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -251,7 +251,7 @@ HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
URLMON_LockModule();
- ret = heap_alloc_zero(sizeof(MimeFilter)); + ret = calloc(1, sizeof(MimeFilter));
ret->IInternetProtocol_iface.lpVtbl = &MimeFilterProtocolVtbl; ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; @@ -467,7 +467,7 @@ static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret) if(*end_ptr) { unsigned len = end_ptr-ptr;
- ext = heap_alloc((len+1)*sizeof(WCHAR)); + ext = malloc((len + 1) * sizeof(WCHAR)); if(!ext) return E_OUTOFMEMORY;
@@ -476,7 +476,7 @@ static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret) }
hres = find_mime_from_ext(ext ? ext : ptr, ret); - heap_free(ext); + free(ext); return hres; }
diff --git a/dlls/urlmon/mk.c b/dlls/urlmon/mk.c index 4fc5681209a..54c01c7148c 100644 --- a/dlls/urlmon/mk.c +++ b/dlls/urlmon/mk.c @@ -89,7 +89,7 @@ static ULONG WINAPI MkProtocolUnk_Release(IUnknown *iface) if(This->stream) IStream_Release(This->stream);
- heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -293,7 +293,7 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, }
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));
progid[colon_ptr-progid] = 0; /* overwrite ':' with NULL terminator */ @@ -301,7 +301,7 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, SysFreeString(path); if(FAILED(hres)) { - heap_free(display_name); + free(display_name); 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, &IID_IParseDisplayName, (void**)&pdn); if(FAILED(hres)) { 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); }
hres = IParseDisplayName_ParseDisplayName(pdn, NULL /* FIXME */, display_name, &eaten, &mon); - heap_free(display_name); + free(display_name); IParseDisplayName_Release(pdn); if(FAILED(hres)) { WARN("ParseDisplayName failed: %08lx\n", hres); @@ -370,7 +370,7 @@ HRESULT MkProtocol_Construct(IUnknown *outer, void **ppv)
URLMON_LockModule();
- ret = heap_alloc(sizeof(MkProtocol)); + ret = malloc(sizeof(MkProtocol));
ret->IUnknown_inner.lpVtbl = &MkProtocolUnkVtbl; ret->IInternetProtocolEx_iface.lpVtbl = &MkProtocolVtbl; diff --git a/dlls/urlmon/protocol.c b/dlls/urlmon/protocol.c index 22cb9549ebe..6c08393b809 100644 --- a/dlls/urlmon/protocol.c +++ b/dlls/urlmon/protocol.c @@ -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);
- info = heap_strdupAtoW(status_info); + info = strdupAtoW(status_info); if(!info) return;
report_progress(protocol, BINDSTATUS_CONNECTING, info); - heap_free(info); + free(info); break; }
@@ -274,7 +274,7 @@ static HINTERNET create_internet_session(IInternetBindInfo *bind_info) global_user_agent = get_useragent();
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); if(!ret) { WARN("InternetOpen failed: %ld\n", GetLastError()); diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index 4529f439b7d..e6d1864b1e7 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -304,15 +304,15 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain WCHAR *component; DWORD i;
- subdomain = heap_alloc((subdomain_len+1)*sizeof(WCHAR)); + subdomain = malloc((subdomain_len + 1) * sizeof(WCHAR)); if(!subdomain) { RegCloseKey(domain_key); return E_OUTOFMEMORY; }
- component = heap_strndupW(host, matched-host-1); + component = strndupW(host, matched-host - 1); if(!component) { - heap_free(subdomain); + free(subdomain); RegCloseKey(domain_key); return E_OUTOFMEMORY; } @@ -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); if(res != ERROR_SUCCESS) { - heap_free(component); - heap_free(subdomain); + free(component); + free(subdomain); RegCloseKey(domain_key); return E_UNEXPECTED; } @@ -336,8 +336,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain if(res != ERROR_SUCCESS) { ERR("Unable to open subdomain key %s of %s: %ld\n", debugstr_w(subdomain), debugstr_w(domain), res); - heap_free(component); - heap_free(subdomain); + free(component); + free(subdomain); RegCloseKey(domain_key); return E_UNEXPECTED; } @@ -348,8 +348,8 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain break; } } - heap_free(subdomain); - heap_free(component); + free(subdomain); + free(component); }
/* 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 if(!domain_count) return S_FALSE;
- domain = heap_alloc((domain_len+1)*sizeof(WCHAR)); + domain = malloc((domain_len + 1) * sizeof(WCHAR)); if(!domain) return E_OUTOFMEMORY;
@@ -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); if(res != ERROR_SUCCESS) { - heap_free(domain); + free(domain); return E_UNEXPECTED; }
@@ -418,7 +418,7 @@ static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR h break; }
- heap_free(domain); + free(domain); return hres; }
@@ -863,7 +863,7 @@ static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManagerEx2* iface) if(This->custom_manager) IInternetSecurityManager_Release(This->custom_manager);
- heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -1208,7 +1208,7 @@ HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) SecManagerImpl *This;
TRACE("(%p,%p)\n",pUnkOuter,ppobj); - This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This));
/* Initialize the virtual function table. */ This->IInternetSecurityManagerEx2_iface.lpVtbl = &VT_SecManagerImpl; @@ -1262,7 +1262,7 @@ static LPDWORD build_zonemap_from_reg(void) if (res) return NULL;
- data = heap_alloc(allocated * sizeof(DWORD)); + data = malloc(allocated * sizeof(DWORD)); if (!data) goto cleanup;
@@ -1276,12 +1276,13 @@ static LPDWORD build_zonemap_from_reg(void) if (used == allocated) { LPDWORD new_data;
- allocated *= 2; - new_data = heap_realloc_zero(data, allocated * sizeof(DWORD)); + new_data = realloc(data, allocated * sizeof(DWORD)); if (!new_data) goto cleanup; + memset(new_data + allocated, 0, allocated * sizeof(DWORD));
data = new_data; + allocated *= 2; } data[used] = wcstol(name, NULL, 10); } @@ -1295,7 +1296,7 @@ static LPDWORD build_zonemap_from_reg(void) cleanup: /* something failed */ RegCloseKey(hkey); - heap_free(data); + free(data); return NULL; }
@@ -1356,9 +1357,9 @@ static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManagerEx2* iface) TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
if(!refCount) { - while (This->zonemap_count) heap_free(This->zonemaps[--This->zonemap_count]); - heap_free(This->zonemaps); - heap_free(This); + while (This->zonemap_count) free(This->zonemaps[--This->zonemap_count]); + free(This->zonemaps); + free(This); URLMON_UnlockModule(); }
@@ -1571,18 +1572,20 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2*
if (This->zonemaps) { /* try to double the nr. of pointers in the array */ - new_maps = heap_realloc_zero(This->zonemaps, This->zonemap_count * 2 * sizeof(LPDWORD)); - if (new_maps) + new_maps = realloc(This->zonemaps, This->zonemap_count * 2 * sizeof(DWORD*)); + if (new_maps) { + memset(new_maps + This->zonemap_count, 0, This->zonemap_count * sizeof(DWORD*)); This->zonemap_count *= 2; + } } else { 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) { - heap_free(data); + free(data); return E_FAIL; } This->zonemaps = new_maps; @@ -1631,7 +1634,7 @@ static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManagerEx2* if (dwEnum < This->zonemap_count) { if ((data = This->zonemaps[dwEnum])) { This->zonemaps[dwEnum] = NULL; - heap_free(data); + free(data); return S_OK; } } @@ -1787,7 +1790,7 @@ static const IInternetZoneManagerEx2Vtbl ZoneMgrImplVtbl = {
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); ret->IInternetZoneManagerEx2_iface.lpVtbl = &ZoneMgrImplVtbl; diff --git a/dlls/urlmon/session.c b/dlls/urlmon/session.c index d533ee8cc97..660fab54570 100644 --- a/dlls/urlmon/session.c +++ b/dlls/urlmon/session.c @@ -76,12 +76,12 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, static const WCHAR wszProtocolsKey[] = {'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 + ARRAY_SIZE(wszProtocolsKey), schema, (schema_len+1)*sizeof(WCHAR));
res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey); - heap_free(wszKey); + free(wszKey); if(res != ERROR_SUCCESS) { TRACE("Could not open protocol handler key\n"); return MK_E_SYNTAX; @@ -115,14 +115,14 @@ HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BO { name_space *new_name_space;
- new_name_space = heap_alloc(sizeof(name_space)); + new_name_space = malloc(sizeof(name_space));
if(!urlmon_protocol) IClassFactory_AddRef(cf); new_name_space->cf = cf; new_name_space->clsid = *clsid; new_name_space->urlmon = urlmon_protocol; - new_name_space->protocol = heap_strdupW(protocol); + new_name_space->protocol = wcsdup(protocol);
EnterCriticalSection(&session_cs);
@@ -147,8 +147,8 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
if(!iter->urlmon) IClassFactory_Release(iter->cf); - heap_free(iter->protocol); - heap_free(iter); + free(iter->protocol); + free(iter); return S_OK; } } @@ -370,12 +370,12 @@ static HRESULT WINAPI InternetSession_RegisterMimeFilter(IInternetSession *iface
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); filter->cf = pCF; filter->clsid = *rclsid; - filter->mime = heap_strdupW(pwzType); + filter->mime = wcsdup(pwzType);
EnterCriticalSection(&session_cs);
@@ -402,8 +402,8 @@ static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *ifa LeaveCriticalSection(&session_cs);
IClassFactory_Release(iter->cf); - heap_free(iter->mime); - heap_free(iter); + free(iter->mime); + free(iter); return S_OK; } } @@ -609,7 +609,7 @@ static void ensure_user_agent(void) if(!user_agent) { WCHAR buf[1024]; obtain_user_agent(0, buf, ARRAY_SIZE(buf)); - user_agent = heap_strdupW(buf); + user_agent = wcsdup(buf); }
LeaveCriticalSection(&session_cs); @@ -622,7 +622,7 @@ LPWSTR get_useragent(void) ensure_user_agent();
EnterCriticalSection(&session_cs); - ret = heap_strdupW(user_agent); + ret = wcsdup(user_agent); LeaveCriticalSection(&session_cs);
return ret; @@ -705,7 +705,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf TRACE("Setting user agent %s\n", debugstr_an(buf, len));
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) return E_OUTOFMEMORY; MultiByteToWideChar(CP_ACP, 0, buf, len, new_user_agent, size); @@ -713,7 +713,7 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf
EnterCriticalSection(&session_cs);
- heap_free(user_agent); + free(user_agent); user_agent = new_user_agent; user_agent_set = TRUE; update_user_agent(user_agent); @@ -800,15 +800,15 @@ void free_session(void) LIST_FOR_EACH_ENTRY_SAFE(ns_iter, ns_last, &name_space_list, name_space, entry) { if(!ns_iter->urlmon) IClassFactory_Release(ns_iter->cf); - heap_free(ns_iter->protocol); - heap_free(ns_iter); + free(ns_iter->protocol); + free(ns_iter); }
LIST_FOR_EACH_ENTRY_SAFE(mf_iter, mf_last, &mime_filter_list, mime_filter, entry) { IClassFactory_Release(mf_iter->cf); - heap_free(mf_iter->mime); - heap_free(mf_iter); + free(mf_iter->mime); + free(mf_iter); }
- heap_free(user_agent); + free(user_agent); } diff --git a/dlls/urlmon/umon.c b/dlls/urlmon/umon.c index d59df7a5f26..0ee8502d070 100644 --- a/dlls/urlmon/umon.c +++ b/dlls/urlmon/umon.c @@ -102,7 +102,7 @@ static ULONG WINAPI URLMoniker_Release(IMoniker *iface) if(This->uri) IUri_Release(This->uri); SysFreeString(This->URLName); - heap_free(This); + free(This);
URLMON_UnlockModule(); } @@ -162,7 +162,7 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm) if(got != sizeof(ULONG)) return E_FAIL;
- new_uri_str = heap_alloc(size+sizeof(WCHAR)); + new_uri_str = malloc(size + sizeof(WCHAR)); if(!new_uri_str) return E_OUTOFMEMORY;
@@ -170,7 +170,7 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm) new_uri_str[size/sizeof(WCHAR)] = 0; if(SUCCEEDED(hres)) hres = CreateUri(new_uri_str, 0, 0, &new_uri); - heap_free(new_uri_str); + free(new_uri_str); if(FAILED(hres)) return hres;
@@ -557,7 +557,7 @@ static HRESULT create_moniker(IUri *uri, URLMoniker **ret) URLMoniker *mon; HRESULT hres;
- mon = heap_alloc(sizeof(*mon)); + mon = malloc(sizeof(*mon)); if(!mon) return E_OUTOFMEMORY;
@@ -569,7 +569,7 @@ static HRESULT create_moniker(IUri *uri, URLMoniker **ret) /* FIXME: try to avoid it */ hres = IUri_GetDisplayUri(uri, &mon->URLName); if(FAILED(hres)) { - heap_free(mon); + free(mon); return hres; }
@@ -843,12 +843,12 @@ HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPST
if(szURL) { 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); }
if(szFileName) - file_name = heap_alloc(dwBufLength*sizeof(WCHAR)); + file_name = malloc(dwBufLength * sizeof(WCHAR));
hres = URLDownloadToCacheFileW(lpUnkCaller, url, file_name, dwBufLength*sizeof(WCHAR), dwReserved, pBSC); @@ -856,8 +856,8 @@ HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPST if(SUCCEEDED(hres) && file_name) WideCharToMultiByte(CP_ACP, 0, file_name, -1, szFileName, dwBufLength, NULL, NULL);
- heap_free(url); - heap_free(file_name); + free(url); + free(file_name);
return hres; } diff --git a/dlls/urlmon/umstream.c b/dlls/urlmon/umstream.c index 082037f2de8..466e7668906 100644 --- a/dlls/urlmon/umstream.c +++ b/dlls/urlmon/umstream.c @@ -269,7 +269,7 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL, return E_INVALIDARG;
len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0); - szURLW = heap_alloc(len * sizeof(WCHAR)); + szURLW = malloc(len * sizeof(WCHAR)); if (!szURLW) { *ppStream = NULL; @@ -279,7 +279,7 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL,
hr = URLOpenBlockingStreamW(pCaller, szURLW, ppStream, dwReserved, lpfnCB);
- heap_free(szURLW); + free(szURLW);
return hr; } @@ -321,14 +321,14 @@ HRESULT WINAPI URLOpenStreamA(LPUNKNOWN pCaller, LPCSTR szURL, DWORD dwReserved, return E_INVALIDARG;
len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0); - szURLW = heap_alloc(len * sizeof(WCHAR)); + szURLW = malloc(len * sizeof(WCHAR)); if (!szURLW) return E_OUTOFMEMORY; MultiByteToWideChar(CP_ACP, 0, szURL, -1, szURLW, len);
hr = URLOpenStreamW(pCaller, szURLW, dwReserved, lpfnCB);
- heap_free(szURLW); + free(szURLW);
return hr; } diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index c774fdf01ad..9d31df22862 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -2966,7 +2966,7 @@ static HRESULT canonicalize_uri(const parse_data *data, Uri *uri, DWORD flags) { return E_INVALIDARG; }
- uri->canon_uri = heap_alloc((len+1)*sizeof(WCHAR)); + uri->canon_uri = malloc((len + 1) * sizeof(WCHAR)); if(!uri->canon_uri) return E_OUTOFMEMORY;
@@ -3001,7 +3001,7 @@ static HRESULT canonicalize_uri(const parse_data *data, Uri *uri, DWORD flags) { /* This happens if the URI is hierarchical and dot * segments were removed from its path. */ - WCHAR *tmp = heap_realloc(uri->canon_uri, (uri->canon_len+1)*sizeof(WCHAR)); + WCHAR *tmp = realloc(uri->canon_uri, (uri->canon_len + 1) * sizeof(WCHAR)); if(!tmp) return E_OUTOFMEMORY;
@@ -3034,7 +3034,7 @@ static HRESULT get_builder_component(LPWSTR *component, DWORD *component_len, /* Allocate 'component', and copy the contents from 'source' * into the new allocation. */ - *component = heap_alloc((source_len+1)*sizeof(WCHAR)); + *component = malloc((source_len + 1) * sizeof(WCHAR)); if(!(*component)) return E_OUTOFMEMORY;
@@ -3057,7 +3057,7 @@ static HRESULT get_builder_component(LPWSTR *component, DWORD *component_len, static HRESULT set_builder_component(LPWSTR *component, DWORD *component_len, LPCWSTR new_value, WCHAR prefix, DWORD *flags, DWORD success_flag) { - heap_free(*component); + free(*component);
if(!new_value) { *component = NULL; @@ -3069,9 +3069,9 @@ static HRESULT set_builder_component(LPWSTR *component, DWORD *component_len, LP
if(prefix && *new_value != prefix) { add_prefix = TRUE; - *component = heap_alloc((len+2)*sizeof(WCHAR)); + *component = malloc((len + 2) * sizeof(WCHAR)); } else - *component = heap_alloc((len+1)*sizeof(WCHAR)); + *component = malloc((len + 1) * sizeof(WCHAR));
if(!(*component)) return E_OUTOFMEMORY; @@ -3092,31 +3092,31 @@ static void reset_builder(UriBuilder *builder) { IUri_Release(&builder->uri->IUri_iface); builder->uri = NULL;
- heap_free(builder->fragment); + free(builder->fragment); builder->fragment = NULL; builder->fragment_len = 0;
- heap_free(builder->host); + free(builder->host); builder->host = NULL; builder->host_len = 0;
- heap_free(builder->password); + free(builder->password); builder->password = NULL; builder->password_len = 0;
- heap_free(builder->path); + free(builder->path); builder->path = NULL; builder->path_len = 0;
- heap_free(builder->query); + free(builder->query); builder->query = NULL; builder->query_len = 0;
- heap_free(builder->scheme); + free(builder->scheme); builder->scheme = NULL; builder->scheme_len = 0;
- heap_free(builder->username); + free(builder->username); builder->username = NULL; builder->username_len = 0;
@@ -3474,12 +3474,12 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret) len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, FALSE, NULL); len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, FALSE, NULL);
- canon_path_a = heap_alloc(len_a*sizeof(WCHAR)); + canon_path_a = malloc(len_a * sizeof(WCHAR)); if(!canon_path_a) return E_OUTOFMEMORY; - canon_path_b = heap_alloc(len_b*sizeof(WCHAR)); + canon_path_b = malloc(len_b * sizeof(WCHAR)); if(!canon_path_b) { - heap_free(canon_path_a); + free(canon_path_a); return E_OUTOFMEMORY; }
@@ -3488,8 +3488,8 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
*ret = len_a == len_b && !wcsnicmp(canon_path_a, canon_path_b, len_a);
- heap_free(canon_path_a); - heap_free(canon_path_b); + free(canon_path_a); + free(canon_path_b); return S_OK; }
@@ -3789,8 +3789,8 @@ static inline Uri* impl_from_IUri(IUri *iface) static inline void destroy_uri_obj(Uri *This) { SysFreeString(This->raw_uri); - heap_free(This->canon_uri); - heap_free(This); + free(This->canon_uri); + free(This); }
static HRESULT WINAPI Uri_QueryInterface(IUri *iface, REFIID riid, void **ppv) @@ -4771,33 +4771,33 @@ static HRESULT WINAPI PersistStream_Load(IPersistStream *iface, IStream *pStm) hr = IStream_Read(pStm, &size, sizeof(DWORD), NULL); if(FAILED(hr)) return hr; - data = heap_alloc(size); + data = malloc(size); if(!data) return E_OUTOFMEMORY; hr = IStream_Read(pStm, data->unk1, size-sizeof(DWORD)-2, NULL); if(FAILED(hr)) { - heap_free(data); + free(data); return hr; }
if(size < sizeof(struct persist_uri)) { - heap_free(data); + free(data); return S_OK; }
if(*(DWORD*)data->data != Uri_PROPERTY_RAW_URI) { - heap_free(data); + free(data); ERR("Can't find raw_uri\n"); return E_UNEXPECTED; }
This->raw_uri = SysAllocString((WCHAR*)(data->data+sizeof(DWORD)*2)); if(!This->raw_uri) { - heap_free(data); + free(data); return E_OUTOFMEMORY; } This->create_flags = data->create_flags; - heap_free(data); + free(data); TRACE("%lx %s\n", This->create_flags, debugstr_w(This->raw_uri));
memset(&parse, 0, sizeof(parse_data)); @@ -4928,14 +4928,14 @@ static HRESULT WINAPI PersistStream_Save(IPersistStream *iface, IStream *pStm, B if(FAILED(hres)) return hres;
- data = heap_alloc_zero(size.u.LowPart); + data = calloc(1, size.u.LowPart); if(!data) return E_OUTOFMEMORY; data->size = size.u.LowPart; persist_stream_save(This, pStm, FALSE, data);
hres = IStream_Write(pStm, data, data->size-2, NULL); - heap_free(data); + free(data); return hres; }
@@ -5108,7 +5108,7 @@ static HRESULT WINAPI Marshal_MarshalInterface(IMarshal *iface, IStream *pStm, R if(FAILED(hres)) return hres;
- data = heap_alloc_zero(size); + data = calloc(1, size); if(!data) return E_OUTOFMEMORY;
@@ -5118,7 +5118,7 @@ static HRESULT WINAPI Marshal_MarshalInterface(IMarshal *iface, IStream *pStm, R persist_stream_save(This, pStm, TRUE, (struct persist_uri*)(data+2));
hres = IStream_Write(pStm, data, data[0]-2, NULL); - heap_free(data); + free(data); return hres; }
@@ -5233,7 +5233,7 @@ static const IMarshalVtbl MarshalVtbl = {
HRESULT Uri_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) { - Uri *ret = heap_alloc_zero(sizeof(Uri)); + Uri *ret = calloc(1, sizeof(Uri));
TRACE("(%p %p)\n", pUnkOuter, ppobj);
@@ -5322,7 +5322,7 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU ret->raw_uri = SysAllocString(pwzURI);
if(!ret->raw_uri) { - heap_free(ret); + free(ret); return E_OUTOFMEMORY; }
@@ -5403,9 +5403,9 @@ HRESULT WINAPI CreateUriWithFragment(LPCWSTR pwzURI, LPCWSTR pwzFragment, DWORD add_pound = *pwzFragment != '#';
if(add_pound) - uriW = heap_alloc((uri_len+frag_len+2)*sizeof(WCHAR)); + uriW = malloc((uri_len + frag_len + 2) * sizeof(WCHAR)); else - uriW = heap_alloc((uri_len+frag_len+1)*sizeof(WCHAR)); + uriW = malloc((uri_len + frag_len + 1) * sizeof(WCHAR));
if(!uriW) return E_OUTOFMEMORY; @@ -5417,7 +5417,7 @@ HRESULT WINAPI CreateUriWithFragment(LPCWSTR pwzURI, LPCWSTR pwzFragment, DWORD
hres = CreateUri(uriW, dwFlags, 0, ppURI);
- heap_free(uriW); + free(uriW); } else /* A fragment string wasn't specified, so just forward the call. */ hres = CreateUri(pwzURI, dwFlags, 0, ppURI); @@ -5527,14 +5527,14 @@ static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface)
if(!ref) { if(This->uri) IUri_Release(&This->uri->IUri_iface); - heap_free(This->fragment); - heap_free(This->host); - heap_free(This->password); - heap_free(This->path); - heap_free(This->query); - heap_free(This->scheme); - heap_free(This->username); - heap_free(This); + free(This->fragment); + free(This->host); + free(This->password); + free(This->path); + free(This->query); + free(This->scheme); + free(This->username); + free(This); }
return ref; @@ -5937,7 +5937,7 @@ HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserve if(!ppIUriBuilder) return E_POINTER;
- ret = heap_alloc_zero(sizeof(UriBuilder)); + ret = calloc(1, sizeof(UriBuilder)); if(!ret) return E_OUTOFMEMORY;
@@ -5949,7 +5949,7 @@ HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserve
if((uri = get_uri_obj(pIUri))) { if(!uri->create_flags) { - heap_free(ret); + free(ret); return E_UNEXPECTED; } IUri_AddRef(pIUri); @@ -5960,7 +5960,7 @@ HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserve ret->port = uri->port;
} else { - heap_free(ret); + free(ret); *ppIUriBuilder = NULL; FIXME("(%p %lx %Ix %p): Unknown IUri types not supported yet.\n", pIUri, dwFlags, dwReserved, ppIUriBuilder); @@ -6005,7 +6005,7 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len, }
if (end) base_copy_len = (end+1)-base; - *result = heap_alloc((base_copy_len+relative_len+1)*sizeof(WCHAR)); + *result = malloc((base_copy_len + relative_len + 1) * sizeof(WCHAR));
if(!(*result)) { *result_len = 0; @@ -6160,7 +6160,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result,
path_len += relative->path_len;
- path = heap_alloc((path_len+1)*sizeof(WCHAR)); + path = malloc((path_len + 1) * sizeof(WCHAR)); if(!path) { *result = NULL; return E_OUTOFMEMORY; @@ -6203,9 +6203,9 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, DWORD new_len = remove_dot_segments(path+offset,path_len-offset);
if(new_len != path_len) { - WCHAR *tmp = heap_realloc(path, (offset+new_len+1)*sizeof(WCHAR)); + WCHAR *tmp = realloc(path, (offset + new_len + 1) * sizeof(WCHAR)); if(!tmp) { - heap_free(path); + free(path); *result = NULL; return E_OUTOFMEMORY; } @@ -6226,7 +6226,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, pptr = &ptr; if((data.is_opaque && !parse_path_opaque(pptr, &data, 0)) || (!data.is_opaque && !parse_path_hierarchical(pptr, &data, 0))) { - heap_free(path); + free(path); *result = NULL; return E_INVALIDARG; } @@ -6245,7 +6245,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, len = generate_raw_uri(&data, data.uri, raw_flags); data.uri = SysAllocStringLen(NULL, len); if(!data.uri) { - heap_free(path); + free(path); *result = NULL; return E_OUTOFMEMORY; } @@ -6255,7 +6255,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, hr = Uri_Construct(NULL, (void**)&ret); if(FAILED(hr)) { SysFreeString(data.uri); - heap_free(path); + free(path); *result = NULL; return hr; } @@ -6280,7 +6280,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, ret->create_flags = create_flags; *result = &ret->IUri_iface;
- heap_free(path); + free(path); }
return S_OK; diff --git a/dlls/urlmon/urlmon_main.c b/dlls/urlmon/urlmon_main.c index 56c2257e100..00ccc449e15 100644 --- a/dlls/urlmon/urlmon_main.c +++ b/dlls/urlmon/urlmon_main.c @@ -75,7 +75,7 @@ tls_data_t *get_tls_data(void)
data = TlsGetValue(urlmon_tls); if(!data) { - data = heap_alloc_zero(sizeof(tls_data_t)); + data = calloc(1, sizeof(tls_data_t)); if(!data) return NULL;
@@ -99,7 +99,7 @@ static void free_tls_list(void) while(!list_empty(&tls_list)) { data = LIST_ENTRY(list_head(&tls_list), tls_data_t, entry); list_remove(&data->entry); - heap_free(data); + free(data); }
TlsFree(urlmon_tls); @@ -125,7 +125,7 @@ static void detach_thread(void) DestroyWindow(data->notif_hwnd); }
- heap_free(data); + free(data); }
static void process_detach(void) diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h index 6687fbd0516..10e5d8447fa 100644 --- a/dlls/urlmon/urlmon_main.h +++ b/dlls/urlmon/urlmon_main.h @@ -31,7 +31,6 @@ #include "urlmon.h" #include "wininet.h"
-#include "wine/heap.h" #include "wine/list.h"
extern HINSTANCE hProxyDll DECLSPEC_HIDDEN; @@ -231,33 +230,12 @@ void release_notif_hwnd(HWND) DECLSPEC_HIDDEN;
const char *debugstr_bindstatus(ULONG) DECLSPEC_HIDDEN;
-static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t size) -{ - 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) +static inline WCHAR *strndupW(LPCWSTR str, int len) { LPWSTR ret = NULL;
if(str) { - ret = heap_alloc((len+1)*sizeof(WCHAR)); + ret = malloc((len + 1) * sizeof(WCHAR)); if(ret) { memcpy(ret, str, len*sizeof(WCHAR)); ret[len] = 0; @@ -267,13 +245,13 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, int len) return ret; }
-static inline LPWSTR heap_strdupAtoW(const char *str) +static inline WCHAR *strdupAtoW(const char *str) { LPWSTR ret = NULL;
if(str) { DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - ret = heap_alloc(len*sizeof(WCHAR)); + ret = malloc(len * sizeof(WCHAR)); if(ret) MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); } diff --git a/dlls/urlmon/usrmarshal.c b/dlls/urlmon/usrmarshal.c index f99e2049520..950d1a3d67a 100644 --- a/dlls/urlmon/usrmarshal.c +++ b/dlls/urlmon/usrmarshal.c @@ -131,7 +131,7 @@ static HRESULT marshal_stgmed(STGMEDIUM *stgmed, RemSTGMEDIUM **ret) 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(stream) IStream_Release(stream); @@ -333,7 +333,7 @@ HRESULT CALLBACK IBindStatusCallback_OnDataAvailable_Proxy(
hres = IBindStatusCallback_RemoteOnDataAvailable_Proxy(This, grfBSCF, dwSize, &rem_formatetc, rem_stgmed);
- heap_free(rem_stgmed); + free(rem_stgmed); return hres; }