wined3d: Properly destroy texture object if we failed to create it's surfaces.

Vitaliy Margolen wine-patch at kievinfo.com
Mon May 29 15:51:33 CDT 2006


ChangeLog:
wined3d: Properly destroy texture object if we failed to create it's surfaces.

 dlls/wined3d/device.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
-------------- next part --------------
9a21a24424d160e01260a9a801b7ac497367743c
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 4a22275..70e5a01 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -843,14 +843,10 @@ HRESULT  WINAPI IWineD3DDeviceImpl_Creat
         /* use the callback to create the texture surface */
         hr = D3DCB_CreateSurface(This->parent, tmpW, tmpH, Format, Usage, Pool, i, &object->surfaces[i],NULL);
         if (hr!= WINED3D_OK || ( (IWineD3DSurfaceImpl *) object->surfaces[i])->Flags & SFLAG_OVERSIZE) {
-            int j;
             FIXME("Failed to create surface  %p\n", object);
             /* clean up */
-            for (j = 0 ; j <= i ; j++) {
-                if(object->surfaces[j]) IWineD3DSurface_Release(object->surfaces[j]);
-            }
-            /* heap free object */
-            HeapFree(GetProcessHeap(), 0, object);
+            object->surfaces[i] = NULL;
+            IWineD3DTexture_Release((IWineD3DTexture *)object);
 
             *ppTexture = NULL;
             return hr;


More information about the wine-patches mailing list