From 42eb516d965bd58677d4debe21c3249d229f4f53 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 21 Oct 2009 10:33:59 +0200 Subject: [PATCH] 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 deletion(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index bd2640854c2..bc9691f6811 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 573be8fdae4..3f736c79132 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; }