Paul Gofman : d3dx9: Avoid double freeing samplers.

Alexandre Julliard julliard at winehq.org
Mon Nov 18 16:19:18 CST 2019


Module: wine
Branch: master
Commit: 6aced396bad8bea61733fda24f0cecabaec5041e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6aced396bad8bea61733fda24f0cecabaec5041e

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Mon Nov 18 16:59:41 2019 +0100

d3dx9: Avoid double freeing samplers.

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/effect.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index ad81cb68cb..eefd14aafa 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -516,8 +516,7 @@ static void free_sampler(struct d3dx_sampler *sampler)
     {
         free_state(&sampler->states[i]);
     }
-    HeapFree(GetProcessHeap(), 0, sampler->states);
-    HeapFree(GetProcessHeap(), 0, sampler);
+    heap_free(sampler->states);
 }
 
 static void d3dx_pool_release_shared_parameter(struct d3dx_top_level_parameter *param);
@@ -531,7 +530,7 @@ static void free_parameter_data(struct d3dx_parameter *param, BOOL child)
         switch (param->type)
         {
             case D3DXPT_STRING:
-                HeapFree(GetProcessHeap(), 0, *(char **)param->data);
+                heap_free(*(char **)param->data);
                 break;
 
             case D3DXPT_TEXTURE:
@@ -557,8 +556,8 @@ static void free_parameter_data(struct d3dx_parameter *param, BOOL child)
                 break;
         }
     }
-    if (!child)
-        HeapFree(GetProcessHeap(), 0, param->data);
+    if (!child || is_param_type_sampler(param->type))
+        heap_free(param->data);
 }
 
 static void free_parameter(struct d3dx_parameter *param, BOOL element, BOOL child)




More information about the wine-cvs mailing list