ole2: Fix error handling in ReadClassStg().
authorNikolay Sivov <nsivov@codeweavers.com>
Sun, 10 Jan 2016 18:45:48 +0000 (21:45 +0300)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 11 Jan 2016 10:54:16 +0000 (19:54 +0900)
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/ole2.dll16/ole2.c

index 0052142ef71d1aad240f16f844b99d9bca52c6be..422469d60e770e34659f7fb1e23e5214867e19f5 100644 (file)
@@ -46,6 +46,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
+#define E_INVALIDARG16 MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 3)
 
 static HICON convert_icon_to_32( HICON16 icon16 )
 {
@@ -296,8 +297,14 @@ HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
 
        TRACE("(%x, %p)\n", pstg, pclsid);
 
-       if(pclsid==NULL)
-               return E_POINTER;
+       if (!pclsid)
+           return E_INVALIDARG16;
+
+       memset(pclsid, 0, sizeof(*pclsid));
+
+       if (!pstg)
+           return E_INVALIDARG16;
+
        /*
         * read a STATSTG structure (contains the clsid) from the storage
         */