From 401110538aa39214280367725f2d8cb80abbc3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 19 Feb 2007 15:18:45 +0100 Subject: [PATCH] wined3d: Check volume texture creation errors. Volumetexture::Release checks for NULL pointers, so releasing a partially created texture works. --- dlls/wined3d/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 30771b0dfbb..510a32ce175 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -939,9 +939,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa for (i = 0; i < object->baseTexture.levels; i++) { + HRESULT hr; /* Create the volume */ - D3DCB_CreateVolume(This->parent, parent, Width, Height, Depth, Format, Pool, Usage, - (IWineD3DVolume **)&object->volumes[i], pSharedHandle); + hr = D3DCB_CreateVolume(This->parent, parent, Width, Height, Depth, Format, Pool, Usage, + (IWineD3DVolume **)&object->volumes[i], pSharedHandle); + + if(FAILED(hr)) { + ERR("Creating a volume for the volume texture failed(%08x)\n", hr); + IWineD3DVolumeTexture_Release((IWineD3DVolumeTexture *) object); + *ppVolumeTexture = NULL; + return hr; + } /* Set its container to this object */ IWineD3DVolume_SetContainer(object->volumes[i], (IWineD3DBase *)object);