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

mshtml: Properly handle OOM errors in navigate.c (coverity).

parent 421368b8
...@@ -215,7 +215,11 @@ static const nsIInputStreamVtbl nsInputStreamVtbl = { ...@@ -215,7 +215,11 @@ static const nsIInputStreamVtbl nsInputStreamVtbl = {
static nsProtocolStream *create_nsprotocol_stream(void) static nsProtocolStream *create_nsprotocol_stream(void)
{ {
nsProtocolStream *ret = heap_alloc(sizeof(nsProtocolStream)); nsProtocolStream *ret;
ret = heap_alloc(sizeof(nsProtocolStream));
if(!ret)
return NULL;
ret->nsIInputStream_iface.lpVtbl = &nsInputStreamVtbl; ret->nsIInputStream_iface.lpVtbl = &nsInputStreamVtbl;
ret->ref = 1; ret->ref = 1;
...@@ -877,8 +881,10 @@ static HRESULT BufferBSC_read_data(BSCallback *bsc, IStream *stream) ...@@ -877,8 +881,10 @@ static HRESULT BufferBSC_read_data(BSCallback *bsc, IStream *stream)
HRESULT hres; HRESULT hres;
if(!This->buf) { if(!This->buf) {
This->buf = heap_alloc(128);
if(!This->buf)
return E_OUTOFMEMORY;
This->size = 128; This->size = 128;
This->buf = heap_alloc(This->size);
} }
do { do {
...@@ -921,23 +927,20 @@ static const BSCallbackVtbl BufferBSCVtbl = { ...@@ -921,23 +927,20 @@ static const BSCallbackVtbl BufferBSCVtbl = {
}; };
static BufferBSC *create_bufferbsc(IMoniker *mon)
{
BufferBSC *ret = heap_alloc_zero(sizeof(*ret));
init_bscallback(&ret->bsc, &BufferBSCVtbl, mon, 0);
ret->hres = E_FAIL;
return ret;
}
HRESULT bind_mon_to_wstr(HTMLInnerWindow *window, IMoniker *mon, WCHAR **ret) HRESULT bind_mon_to_wstr(HTMLInnerWindow *window, IMoniker *mon, WCHAR **ret)
{ {
BufferBSC *bsc = create_bufferbsc(mon); BufferBSC *bsc;
int cp = CP_ACP; int cp = CP_ACP;
WCHAR *text; WCHAR *text;
HRESULT hres; HRESULT hres;
bsc = heap_alloc_zero(sizeof(*bsc));
if(!bsc)
return E_OUTOFMEMORY;
init_bscallback(&bsc->bsc, &BufferBSCVtbl, mon, 0);
bsc->hres = E_FAIL;
hres = start_binding(window, &bsc->bsc, NULL); hres = start_binding(window, &bsc->bsc, NULL);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
hres = bsc->hres; hres = bsc->hres;
...@@ -1164,8 +1167,11 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream) ...@@ -1164,8 +1167,11 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
return S_OK; return S_OK;
} }
if(!This->nsstream) if(!This->nsstream) {
This->nsstream = create_nsprotocol_stream(); This->nsstream = create_nsprotocol_stream();
if(!This->nsstream)
return E_OUTOFMEMORY;
}
do { do {
BOOL first_read = !This->bsc.readed; BOOL first_read = !This->bsc.readed;
......
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