Commit 76696cd9 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

mshtml: Handle memory allocation failure in ConnectionPoint_Advise.

parent db691cd9
...@@ -216,6 +216,7 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown * ...@@ -216,6 +216,7 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
{ {
ConnectionPoint *This = impl_from_IConnectionPoint(iface); ConnectionPoint *This = impl_from_IConnectionPoint(iface);
IUnknown *sink; IUnknown *sink;
void *new_sinks;
DWORD i; DWORD i;
HRESULT hres; HRESULT hres;
...@@ -227,18 +228,19 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown * ...@@ -227,18 +228,19 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
if(FAILED(hres)) if(FAILED(hres))
return CONNECT_E_CANNOTCONNECT; return CONNECT_E_CANNOTCONNECT;
if(This->sinks) { for(i = 0; i < This->sinks_size; i++) {
for(i=0; i<This->sinks_size; i++) { if(!This->sinks[i].unk)
if(!This->sinks[i].unk) break;
break; }
}
if(i == This->sinks_size) if(i == This->sinks_size) {
This->sinks = realloc(This->sinks, (++This->sinks_size) * sizeof(*This->sinks)); new_sinks = realloc(This->sinks, (This->sinks_size + 1) * sizeof(*This->sinks));
}else { if(!new_sinks) {
This->sinks = malloc(sizeof(*This->sinks)); IUnknown_Release(sink);
This->sinks_size = 1; return E_OUTOFMEMORY;
i = 0; }
This->sinks = new_sinks;
This->sinks_size++;
} }
This->sinks[i].unk = sink; This->sinks[i].unk = sink;
......
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