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)
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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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());
......
......@@ -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;
......
......@@ -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);
}
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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;
}
......
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