wined3d: Fix resource cleanup if CreateCubeTexture fails.

This commit is contained in:
Allan Tong 2007-10-18 23:39:22 -04:00 committed by Alexandre Julliard
parent 25e15ddb51
commit ac6f2009f2
1 changed files with 8 additions and 2 deletions

View File

@ -1107,10 +1107,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) { if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
if(!GL_SUPPORT(SGIS_GENERATE_MIPMAP)) { if(!GL_SUPPORT(SGIS_GENERATE_MIPMAP)) {
WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n"); WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n");
HeapFree(GetProcessHeap(), 0, object);
*ppCubeTexture = NULL;
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
if(Levels > 1) { if(Levels > 1) {
WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n"); WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n");
HeapFree(GetProcessHeap(), 0, object);
*ppCubeTexture = NULL;
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
Levels = 1; Levels = 1;
@ -1139,11 +1145,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
int k; int k;
int l; int l;
for (l = 0; l < j; l++) { for (l = 0; l < j; l++) {
IWineD3DSurface_Release(object->surfaces[j][i]); IWineD3DSurface_Release(object->surfaces[l][i]);
} }
for (k = 0; k < i; k++) { for (k = 0; k < i; k++) {
for (l = 0; l < 6; l++) { for (l = 0; l < 6; l++) {
IWineD3DSurface_Release(object->surfaces[l][j]); IWineD3DSurface_Release(object->surfaces[l][k]);
} }
} }