Commit c5e53bd6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

shdocvw: Use heap_alloc_zero to allocate DocHost objects.

parent 355b9b66
...@@ -163,7 +163,7 @@ HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv) ...@@ -163,7 +163,7 @@ HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv)
TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv); TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
ret = heap_alloc(sizeof(InternetExplorer)); ret = heap_alloc_zero(sizeof(InternetExplorer));
ret->ref = 0; ret->ref = 0;
ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret); ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret);
......
...@@ -960,17 +960,6 @@ void WebBrowser_OleObject_Init(WebBrowser *This) ...@@ -960,17 +960,6 @@ void WebBrowser_OleObject_Init(WebBrowser *This)
This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl; This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl; This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
This->client = NULL;
This->inplace = NULL;
This->container = NULL;
This->frame_hwnd = NULL;
This->uiwindow = NULL;
This->shell_embedding_hwnd = NULL;
memset(&This->pos_rect, 0, sizeof(RECT));
memset(&This->clip_rect, 0, sizeof(RECT));
memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
/* Default size is 50x20 pixels, in himetric units */ /* Default size is 50x20 pixels, in himetric units */
This->extent.cx = MulDiv( 50, 2540, dpi_x ); This->extent.cx = MulDiv( 50, 2540, dpi_x );
This->extent.cy = MulDiv( 20, 2540, dpi_y ); This->extent.cy = MulDiv( 20, 2540, dpi_y );
......
...@@ -262,6 +262,11 @@ static inline void *heap_alloc(size_t len) ...@@ -262,6 +262,11 @@ static inline void *heap_alloc(size_t len)
return HeapAlloc(GetProcessHeap(), 0, len); return HeapAlloc(GetProcessHeap(), 0, len);
} }
static inline void *heap_alloc_zero(size_t len)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
static inline void *heap_realloc(void *mem, size_t len) static inline void *heap_realloc(void *mem, size_t len)
{ {
return HeapReAlloc(GetProcessHeap(), 0, mem, len); return HeapReAlloc(GetProcessHeap(), 0, mem, len);
......
...@@ -1115,23 +1115,20 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi ...@@ -1115,23 +1115,20 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi
TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version); TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
ret = heap_alloc(sizeof(WebBrowser)); ret = heap_alloc_zero(sizeof(WebBrowser));
ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl; ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
ret->lpServiceProviderVtbl = &ServiceProviderVtbl; ret->lpServiceProviderVtbl = &ServiceProviderVtbl;
ret->ref = 0; ret->ref = 1;
ret->version = version; ret->version = version;
DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret)); DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
ret->register_browser = VARIANT_FALSE;
ret->visible = VARIANT_TRUE; ret->visible = VARIANT_TRUE;
ret->menu_bar = VARIANT_TRUE; ret->menu_bar = VARIANT_TRUE;
ret->address_bar = VARIANT_TRUE; ret->address_bar = VARIANT_TRUE;
ret->status_bar = VARIANT_TRUE; ret->status_bar = VARIANT_TRUE;
ret->tool_bar = VARIANT_TRUE; ret->tool_bar = VARIANT_TRUE;
ret->full_screen = VARIANT_FALSE;
ret->theater_mode = VARIANT_FALSE;
WebBrowser_OleObject_Init(ret); WebBrowser_OleObject_Init(ret);
WebBrowser_ViewObject_Init(ret); WebBrowser_ViewObject_Init(ret);
...@@ -1139,14 +1136,11 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi ...@@ -1139,14 +1136,11 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi
WebBrowser_ClassInfo_Init(ret); WebBrowser_ClassInfo_Init(ret);
WebBrowser_HlinkFrame_Init(ret); WebBrowser_HlinkFrame_Init(ret);
SHDOCVW_LockModule();
hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv); hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
if(SUCCEEDED(hres)) {
SHDOCVW_LockModule();
}else {
heap_free(ret);
return hres;
}
IWebBrowser2_Release(WEBBROWSER(ret));
return hres; return hres;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment