Commit 02bb8401 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

inetcomm: Use standard C functions for memory allocation in protocol.c.

parent 8459a527
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "inetcomm_private.h" #include "inetcomm_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(inetcomm); WINE_DEFAULT_DEBUG_CHANNEL(inetcomm);
...@@ -62,22 +61,6 @@ typedef struct { ...@@ -62,22 +61,6 @@ typedef struct {
static const WCHAR mhtml_prefixW[] = L"mhtml:"; static const WCHAR mhtml_prefixW[] = L"mhtml:";
static const WCHAR mhtml_separatorW[] = L"!x-usc:"; static const WCHAR mhtml_separatorW[] = L"!x-usc:";
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 HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r) static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r)
{ {
const WCHAR *p; const WCHAR *p;
...@@ -247,7 +230,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface) ...@@ -247,7 +230,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
IInternetProtocol_Release(&This->protocol->IInternetProtocol_iface); IInternetProtocol_Release(&This->protocol->IInternetProtocol_iface);
if(This->stream) if(This->stream)
IStream_Release(This->stream); IStream_Release(This->stream);
heap_free(This); free(This);
} }
return ref; return ref;
...@@ -419,8 +402,8 @@ static ULONG WINAPI MimeHtmlProtocol_Release(IUnknown *iface) ...@@ -419,8 +402,8 @@ static ULONG WINAPI MimeHtmlProtocol_Release(IUnknown *iface)
IInternetProtocolSink_Release(This->sink); IInternetProtocolSink_Release(This->sink);
if(This->stream) if(This->stream)
IStream_Release(This->stream); IStream_Release(This->stream);
heap_free(This->location); free(This->location);
heap_free(This); free(This);
} }
return ref; return ref;
...@@ -475,7 +458,7 @@ static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCH ...@@ -475,7 +458,7 @@ static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCH
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(url.location && !(This->location = heap_strdupW(url.location))) if(url.location && !(This->location = wcsdup(url.location)))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo); hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
...@@ -488,7 +471,7 @@ static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCH ...@@ -488,7 +471,7 @@ static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCH
IInternetProtocolSink_AddRef(This->sink = pOIProtSink); IInternetProtocolSink_AddRef(This->sink = pOIProtSink);
binding = heap_alloc(FIELD_OFFSET(MimeHtmlBinding, url[url.mhtml_len+1])); binding = malloc(FIELD_OFFSET(MimeHtmlBinding, url[url.mhtml_len+1]));
if(!binding) if(!binding)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(binding->url, url.mhtml, url.mhtml_len*sizeof(WCHAR)); memcpy(binding->url, url.mhtml, url.mhtml_len*sizeof(WCHAR));
...@@ -496,7 +479,7 @@ static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCH ...@@ -496,7 +479,7 @@ static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCH
hres = CreateURLMoniker(NULL, binding->url, &mon); hres = CreateURLMoniker(NULL, binding->url, &mon);
if(FAILED(hres)) { if(FAILED(hres)) {
heap_free(binding); free(binding);
return hres; return hres;
} }
...@@ -729,7 +712,7 @@ HRESULT MimeHtmlProtocol_create(IUnknown *outer, void **obj) ...@@ -729,7 +712,7 @@ HRESULT MimeHtmlProtocol_create(IUnknown *outer, void **obj)
{ {
MimeHtmlProtocol *protocol; MimeHtmlProtocol *protocol;
protocol = heap_alloc(sizeof(*protocol)); protocol = malloc(sizeof(*protocol));
if(!protocol) if(!protocol)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
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