Allan Tong : wined3d: Fix resource cleanup if CreateCubeTexture fails.
Alexandre Julliard
julliard at winehq.org
Fri Oct 19 08:35:44 CDT 2007
Module: wine
Branch: master
Commit: ac6f2009f20871dafde900a624424fcb5bd58a75
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ac6f2009f20871dafde900a624424fcb5bd58a75
Author: Allan Tong <actong88 at gmail.com>
Date: Thu Oct 18 23:39:22 2007 -0400
wined3d: Fix resource cleanup if CreateCubeTexture fails.
---
dlls/wined3d/device.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a7a586d..5038350 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1107,10 +1107,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
if(!GL_SUPPORT(SGIS_GENERATE_MIPMAP)) {
WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n");
+ HeapFree(GetProcessHeap(), 0, object);
+ *ppCubeTexture = NULL;
+
return WINED3DERR_INVALIDCALL;
}
if(Levels > 1) {
WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n");
+ HeapFree(GetProcessHeap(), 0, object);
+ *ppCubeTexture = NULL;
+
return WINED3DERR_INVALIDCALL;
}
Levels = 1;
@@ -1139,11 +1145,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
int k;
int 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 (l = 0; l < 6; l++) {
- IWineD3DSurface_Release(object->surfaces[l][j]);
+ IWineD3DSurface_Release(object->surfaces[l][k]);
}
}
More information about the wine-cvs
mailing list