vc4: Fix a leak of the src[] array of VPM reads in optimization.
authorEric Anholt <eric@anholt.net>
Tue, 2 Aug 2016 18:02:21 +0000 (11:02 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 3 Aug 2016 17:25:09 +0000 (10:25 -0700)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/vc4/vc4_opt_vpm.c

index 34ea33635117c1e534326067680653498f079c98..83ba11b817f753634777104da3d65e5b91ea058f 100644 (file)
@@ -115,11 +115,12 @@ qir_opt_vpm(struct vc4_compile *c)
                          * sources are independent of previous instructions
                          */
                         if (temps == 1) {
-                                list_del(&inst->link);
                                 inst->src[j] = mov->src[0];
-                                list_replace(&mov->link, &inst->link);
-                                c->defs[temp] = NULL;
-                                free(mov);
+
+                                list_del(&inst->link);
+                                list_addtail(&inst->link, &mov->link);
+                                qir_remove_instruction(c, mov);
+
                                 progress = true;
                                 break;
                         }