Henri Verbeet : wined3d: Free the adapter' s format info in IWineD3DImpl_Release() (Valgrind).

Alexandre Julliard julliard at winehq.org
Wed Oct 21 13:14:00 CDT 2009


Module: wine
Branch: master
Commit: 42eb516d965bd58677d4debe21c3249d229f4f53
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=42eb516d965bd58677d4debe21c3249d229f4f53

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Oct 21 10:33:59 2009 +0200

wined3d: Free the adapter's format info in IWineD3DImpl_Release() (Valgrind).

---

 dlls/wined3d/directx.c |    8 +++++++-
 dlls/wined3d/utils.c   |    2 ++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index bd26408..bc9691f 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -334,6 +334,12 @@ long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram)
     return adapter->UsedTextureRam;
 }
 
+static void wined3d_adapter_cleanup(struct wined3d_adapter *adapter)
+{
+    HeapFree(GetProcessHeap(), 0, adapter->gl_info.gl_formats);
+    HeapFree(GetProcessHeap(), 0, adapter->cfgs);
+}
+
 /**********************************************************
  * IUnknown parts follows
  **********************************************************/
@@ -372,7 +378,7 @@ static ULONG WINAPI IWineD3DImpl_Release(IWineD3D *iface) {
 
         for (i = 0; i < This->adapter_count; ++i)
         {
-            HeapFree(GetProcessHeap(), 0, This->adapters[i].cfgs);
+            wined3d_adapter_cleanup(&This->adapters[i]);
         }
         HeapFree(GetProcessHeap(), 0, This);
     }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 573be8f..3f736c7 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -1112,6 +1112,7 @@ BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info)
     if (!init_format_compression_info(gl_info))
     {
         HeapFree(GetProcessHeap(), 0, gl_info->gl_formats);
+        gl_info->gl_formats = NULL;
         return FALSE;
     }
 
@@ -1135,6 +1136,7 @@ BOOL initPixelFormats(struct wined3d_gl_info *gl_info)
 
 fail:
     HeapFree(GetProcessHeap(), 0, gl_info->gl_formats);
+    gl_info->gl_formats = NULL;
     return FALSE;
 }
 




More information about the wine-cvs mailing list