[PATCH] d3dcompiler: Iterate through the instruction list in reverse in free_instr_list() (Valgrind).

Zebediah Figura z.figura12 at gmail.com
Wed Aug 5 11:31:20 CDT 2020


To avoid heap corruption when unlinking the instruction from the "uses" list.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
Alternatively, we could make unlinking into a separate operation.

 dlls/d3dcompiler_43/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index e8bdbea7e13..ac5722e11aa 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1937,7 +1937,7 @@ void free_instr_list(struct list *list)
 
     if (!list)
         return;
-    LIST_FOR_EACH_ENTRY_SAFE(node, next_node, list, struct hlsl_ir_node, entry)
+    LIST_FOR_EACH_ENTRY_SAFE_REV(node, next_node, list, struct hlsl_ir_node, entry)
         free_instr(node);
     d3dcompiler_free(list);
 }
-- 
2.27.0




More information about the wine-devel mailing list