Lei Zhang : oleaut32: Check return values in several functions.
Alexandre Julliard
julliard at winehq.org
Mon Jul 21 08:52:06 CDT 2008
Module: wine
Branch: master
Commit: 4fe68a9e1e8a4267217e9b2808d32f67c4411df4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4fe68a9e1e8a4267217e9b2808d32f67c4411df4
Author: Lei Zhang <thestig at google.com>
Date: Fri Jul 18 15:25:31 2008 -0700
oleaut32: Check return values in several functions.
---
dlls/oleaut32/olepicture.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index ea0297f..8dc10ed 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -1365,6 +1365,8 @@ static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
DIB_RGB_COLORS
);
DeleteDC(hdcref);
+ if (This->desc.u.bmp.hbitmap == 0)
+ return E_FAIL;
This->desc.picType = PICTYPE_BITMAP;
OLEPictureImpl_SetBitmap(This);
return S_OK;
@@ -1869,6 +1871,8 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
} else {
This->datalen = toread+(headerisdata?8:0);
xbuf = This->data = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, This->datalen);
+ if (!xbuf)
+ return E_OUTOFMEMORY;
if (headerisdata)
memcpy (xbuf, header, 8);
@@ -2644,8 +2648,15 @@ HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
*ppvObj = NULL;
return hr;
}
- IPersistStream_Load(ps,lpstream);
+ hr = IPersistStream_Load(ps,lpstream);
IPersistStream_Release(ps);
+ if (FAILED(hr))
+ {
+ ERR("IPersistStream_Load failed\n");
+ IPicture_Release(newpic);
+ *ppvObj = NULL;
+ return hr;
+ }
hr = IPicture_QueryInterface(newpic,riid,ppvObj);
if (hr)
FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
More information about the wine-cvs
mailing list