lima/ppir: fix pointer referenced after a free
authorPatrick Lerda <patrick9876@free.fr>
Mon, 29 Apr 2019 08:43:51 +0000 (10:43 +0200)
committernoblock <noblock@users.noreply.github.com>
Mon, 29 Apr 2019 08:43:51 +0000 (10:43 +0200)
Issue detected by valgrind.

Fixes: 92d7ca4b1cd ("gallium: add lima driver")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
src/gallium/drivers/lima/ir/pp/lower.c

index e294f6740d149a7a081bcd33f1dc962009852c95..97243dcfa3f768d88760f0588e3239f135160f9d 100644 (file)
@@ -94,8 +94,9 @@ static bool ppir_lower_dot(ppir_block *block, ppir_node *node)
    dest->write_mask = u_bit_consecutive(0, num_components);
 
    ppir_node_foreach_pred_safe(node, dep) {
+      ppir_node *pred = dep->pred;
       ppir_node_remove_dep(dep);
-      ppir_node_add_dep(&mul->node, dep->pred);
+      ppir_node_add_dep(&mul->node, pred);
    }
    ppir_node_add_dep(node, &mul->node);