diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c index ca2c868d13d..d65810f58f9 100644 --- a/dlls/shdocvw/iexplore.c +++ b/dlls/shdocvw/iexplore.c @@ -163,7 +163,7 @@ HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **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->doc_host.disp = (IDispatch*)WEBBROWSER2(ret); diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c index f67edb7583e..933b5629cea 100644 --- a/dlls/shdocvw/oleobject.c +++ b/dlls/shdocvw/oleobject.c @@ -960,17 +960,6 @@ void WebBrowser_OleObject_Init(WebBrowser *This) This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl; 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 */ This->extent.cx = MulDiv( 50, 2540, dpi_x ); This->extent.cy = MulDiv( 20, 2540, dpi_y ); diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h index c5b9c9a1be5..c734f04f5cd 100644 --- a/dlls/shdocvw/shdocvw.h +++ b/dlls/shdocvw/shdocvw.h @@ -262,6 +262,11 @@ static inline void *heap_alloc(size_t 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) { return HeapReAlloc(GetProcessHeap(), 0, mem, len); diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c index b0633b03f19..2ac9b9985d5 100644 --- a/dlls/shdocvw/webbrowser.c +++ b/dlls/shdocvw/webbrowser.c @@ -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); - ret = heap_alloc(sizeof(WebBrowser)); + ret = heap_alloc_zero(sizeof(WebBrowser)); ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl; ret->lpServiceProviderVtbl = &ServiceProviderVtbl; - ret->ref = 0; + ret->ref = 1; ret->version = version; DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret)); - ret->register_browser = VARIANT_FALSE; ret->visible = VARIANT_TRUE; ret->menu_bar = VARIANT_TRUE; ret->address_bar = VARIANT_TRUE; ret->status_bar = VARIANT_TRUE; ret->tool_bar = VARIANT_TRUE; - ret->full_screen = VARIANT_FALSE; - ret->theater_mode = VARIANT_FALSE; WebBrowser_OleObject_Init(ret); WebBrowser_ViewObject_Init(ret); @@ -1139,14 +1136,11 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi WebBrowser_ClassInfo_Init(ret); WebBrowser_HlinkFrame_Init(ret); - hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv); - if(SUCCEEDED(hres)) { - SHDOCVW_LockModule(); - }else { - heap_free(ret); - return hres; - } + SHDOCVW_LockModule(); + hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv); + + IWebBrowser2_Release(WEBBROWSER(ret)); return hres; }