Re: [PATCH] ole32: check for interface NULL which happens with e.g. Abiword
16 Sep
2010
16 Sep
'10
4:06 p.m.
Marcus Meissner <marcus(a)jet.franken.de> wrote:
+ unk = NULL; hr = IDropTarget_QueryInterface(pDropTarget, &IID_IUnknown, (void**)&unk); if(FAILED(hr)) { IStream_Release(stream); return hr; } + if (!unk) { + WARN("hr was %d, but unk is NULL.\n", hr); + IStream_Release(stream); + return E_NOINTERFACE; + } hr = CoMarshalInterface(stream, &IID_IDropTarget, unk, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG); IUnknown_Release(unk);
Huw suggested a more simple solution which doesn't lead to duplicated code: + unk = NULL; hr = IDropTarget_QueryInterface(pDropTarget, &IID_IUnknown, (void**)&unk); + if (!unk) hr = E_NOINTERFACE; if(FAILED(hr)) -- Dmitry.
5569
Age (days ago)
5569
Last active (days ago)
0 comments
1 participants
participants (1)
-
Dmitry Timoshkov