[PATCH] ole32: check for interface NULL which happens with e.g. Abiword

Marcus Meissner marcus at jet.franken.de
Thu Sep 16 09:41:36 CDT 2010


Hi,

spotted by reporters in #winehackers, via
http://www.abisource.com/downloads/abiword/2.6.8/Windows/abiword-setup-2.6.8.exe

hr is S_OK, but unk is also NULL.

Lets return E_NOINTERFACE.

Ciao, Marcus
---
 dlls/ole32/ole2.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index a9a4885..d92fef0 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -450,12 +450,18 @@ HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
   hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
   if(FAILED(hr)) return hr;
 
+  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);
 
-- 
1.5.6




More information about the wine-patches mailing list